Skip to content

prototype(gc): explore static root/context binding with scoped roots#74

Closed
Flamki wants to merge 1 commit intoboa-dev:mainfrom
Flamki:feat/scoped-root-static-proof
Closed

prototype(gc): explore static root/context binding with scoped roots#74
Flamki wants to merge 1 commit intoboa-dev:mainfrom
Flamki:feat/scoped-root-static-proof

Conversation

@Flamki
Copy link
Copy Markdown
Contributor

@Flamki Flamki commented Apr 5, 2026

Part of #68.

This is a focused follow-up to explore static root/context pairing in the API prototype without changing the merged long-lived Root<T> path.

What changed

  • Added ScopedRoot<'gc, T> in examples/api_prototype/gc.rs.
  • Added MutationContext::root_scoped(...) -> ScopedRoot<'gc, T>.
  • ScopedRoot::get requires &MutationContext<'gc>, so usage remains tied to the same mutation lifetime.
  • Added example test scoped_root_is_context_bound.
  • Added UI compile-fail tests:
    • scoped_root_cannot_escape_mutate
    • scoped_root_cannot_cross_context (brand-mismatch feasibility proof)
  • Updated notes/api-redesign-prototype/prototype_findings.md with the experiment rationale/results.

Why

  • #68 currently uses runtime collector-id validation for long-lived roots.
  • This follow-up checks how far we can push static guarantees for a scoped-root path.

Scope

  • prototype/example + notes only
  • no change to oscars/src collector APIs

Validation

  • cargo fmt --all -- --check
  • cargo test --workspace -q
  • cargo clippy --workspace --all-features --all-targets -q

@jedel1043
Copy link
Copy Markdown
Member

Duplicate of #73

@jedel1043 jedel1043 marked this as a duplicate of #73 Apr 7, 2026
@jedel1043 jedel1043 closed this Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants