Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unified reference 'setting' API #26

Closed
kaleidawave opened this issue Jun 9, 2023 · 1 comment
Closed

Unified reference 'setting' API #26

kaleidawave opened this issue Jun 9, 2023 · 1 comment
Assignees
Labels
context Contexts (root or environment)

Comments

@kaleidawave
Copy link
Owner

Envisioning a Reference enum (rename existing Reference from events to RootReference) that is a enum Reference { Variable(VariableId), Property { on: TypeId, key: TypeId } }. The there could be a set_reference method on Context that is the following.

fn set_reference<T: crate::FSResolver, U: Operator>(
   &mut self,
   reference: Reference,
   operation: U,
   rhs: &U::RHS,
   checking_data: &mut CheckingData<T>
) -> TypeId

Where Operator is the following

trait Operator {
    type RHS: SynthesiseToType;

    fn return_behavior(&self) -> ReturnBehavior;
}

trait SynthesiseToType {
    fn to_type(&self, ...) -> TypeId;
}

enum ReturnBehavior {
    NewValue,
    OldValue
}

This would handle all the update/assignment operations and (hopefully) be the simplest way to add this.

@kaleidawave kaleidawave added the context Contexts (root or environment) label Jun 9, 2023
@kaleidawave kaleidawave self-assigned this Jun 14, 2023
@kaleidawave
Copy link
Owner Author

This was completed in #31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context Contexts (root or environment)
Projects
None yet
Development

No branches or pull requests

1 participant