-
Notifications
You must be signed in to change notification settings - Fork 3
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
immutable Universe #27
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely makes sense to not pollute the universe with random symbols users might've used in all their queries.
The main thing that's important is that the underlying RuleSet
in the universe doesn't get further modified before the query is then actually run, because then you might get conflicts. But your design neatly prevents that, so I think it should be good to go this way.
I commented on a few things I noticed, but I don't see any major blockers.
I removed the WIP, as all feedback has been addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! I still have a few smaller comments, but the overall design looks good to me!
BTW, since I noticed some formatting changes (one fixing something cargo fmt
would not agree with, but another one that cargo fmt
would do differently), I added cargo fmt
to the CI checks, so if you could rebase once more?
This way imports can be conditional on test build.
433f6d3
to
f497710
Compare
Added SymbolOverlay which contains changes needed to execute a particular query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Let me know when a new release is out, I want to incorporate those APIs in my own release. |
This PR and the others are now available as v0.4.0 on crates.io. |
Using Queries is currently awkward because creating them requires a &mut Universe. In my case, this means either a RefCell on the database which wraps Universe.
This pushes errors from compile-time to runtime, which is not so great.
I looked into creating the Query, and the only thing the &mut is for is to put additional symbols in the symbols store. This gave me the idea: why not bundle symbols with the Query and call it the UniverseQuery?
This makes the original Universe obsolete for this query, but the problems with &mut are gone.
In this patch, I decided that the original Universe doesn't have to be copied with every query, so I sketched the type for a lighter SymbolsOverlay:
and I stopped there so far.
Does this look like a good direction?