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

pico: speculative: multiple levels of guards #424

Open
rbalicki2 opened this issue Feb 23, 2025 · 0 comments
Open

pico: speculative: multiple levels of guards #424

rbalicki2 opened this issue Feb 23, 2025 · 0 comments
Labels

Comments

@rbalicki2
Copy link
Collaborator

It is nice that MemoRef has a 'db lifetime, meaning that you can't call .garbage_collect / db.set/db.remove when there is a MemoRef, all of which could change its value or remove it.

I wonder if we can have something similar for SourceRef<'db>, where:

  • If a SourceRef exists, no deletions are allowed, but you can create/update sources

So there's a heirarchy:

  • MemoRef exists -> no changes to DB state
  • SourceRef exists -> no deletions of sources
  • Nothing exists -> anything allowed

Furthermore, I wonder if we can do this via ownership rules.

Right now, we can enforce that if a MemoRef exists, you can't mutate the DB because of ownership rules. Can we have two structs (e.g. a SourceRef only takes a reference to a sub-struct?) to pull this off with ownership rules?

Anyway, speculative and low-importance

@rbalicki2 rbalicki2 added the pico label Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant