Open matklad opened 6 years ago
I think remove
makes sense for inputs but not derived queries. I hadn't expected the GC to prune the inputs.
So now that inputs panic if there is no value, I guess a remove
would be fairly straightforward to implement. It would be "on you" though to ensure that when you remove something, no derived query will access it, right?
I imagine in that case we can literally just remove the key from the map and trigger the next revision, full stop.
I guess so!
We probably need to forbid removal of constants, and we need to review maybe_changed_since
logic, though it seems correct.
Would a PR for this be welcome?
We have a
set
method to associate a value with a key, but we don't have a correspondingremove
method. I need this because I try to model a set of files, known to rust-analyzer, as two queries:One query returns text, given file id. Another query returns a set of file ids. Currently, I can add and change files, but removing files is not really possible: a file can be removed from
FileSet
, but not fromFileText
.Perhaps this all should be left to GC though?