[wildcard] Replace graph-based borrow checking with Compile-Time Affine Capability Tokens
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 8/100
Direzione di ricerca
This is a design proposal, not a code change. Start by reading hy-check/src/loans.rs and hy-check/src/alias.rs, then the soundness issues it cites (#27, #82, #137, #138). Done would be a written set of token transition rules checked against those issues, and the proposal's own falsification gate decides whether it survives.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The idea, in a paragraph
Currently, Hybrid maintains a complex, reactive graph of aliases (record_alias, record_may_share), mutable loan windows (LoanTarget::MapSlot, LoanTarget::Handle), and freeze states across lexical statements to approximate Rust-like borrow checking over Go semantics. As evidenced by recent soundness waves (#27, #82, #137, #138), this graph approach suffers from combinatorial edge holes whenever bindings cross closure captures, inner-scope rebinds, or interprocedural returns.
Instead of tracking pointers and mutable borrows via ambient graph state, replace the entire loan/alias engine with Affine Capability Tokens (Cap[T]) threaded through the typing environment. Accessing mutable state or transferring across concurrency boundaries requires consuming or splitting an unforgeable capability token. Borrowing is syntactically a scoped token split; moving is a linear consumption. The entire mutable state in st.loans, st.aliases, and st.shares can be replaced with a single forward O(N) token-balance verification pass.
Which assumption it breaks
- Directly answers Solicitation Prompt 2: "Replace the borrow-checker machinery. Capability tokens, linear-type encodings inside Go's type system, runtime-enforced ownership — anything that deletes the alias/loan/freeze analysis rather than extending it."
- Kills the sacred cow that Hybrid needs an ad-hoc Rust-like borrow graph engine (
loans.rs,alias.rs, graph-based freeze tracking) to guarantee data-race freedom. - Kills statement-level retroactive loan patching in favor of compositional type-level capabilities.
Why this is a breakthrough, not an increment
Feature bounties are trapped in a cycle of adding defensive patches to loans.rs and alias.rs (interprocedural windows, map-slot re-assignments, closure-local aliasing, field projections). Each fix deepens coupling and increases compilation complexity.
Capability tokens invert the paradigm: the compiler stops asking "where might an alias have leaked in the AST?" and instead asks "does the current expression hold an active capability token to perform this mutation or transfer?". By treating capabilities as affine resources:
- Data races and use-after-free are structurally impossible by construction—there is no graph to bypass.
- In the emitted Go code, capability tokens are zero-cost phantom types (
type Cap[T] struct{}) completely erased bygc/ Go compiler.
How we would know it works (or doesn't)
Falsifiable Milestones:
-
M1 ($250 milestone): Theoretical typing rules & soundness stress-test
Formulate the 3 core token transition rules: Mint (allocation), Split/Borrow (disjoint read permissions), and Consume (move / task spawn). Verify these rules against the 10 landmark soundness issues in Hybrid's history (#27, #37, #69, #72, #82, #117, #137, #138, #141, #143).
Falsification gate: If any of these 10 soundness hazards can be expressed without causing a token imbalance under the formal rules, the proposal fails immediately at M1. -
M2 ($250 milestone): Corpus validation & usability limit analysis
Implement a prototype token-balance pass and run it against all 42 corpus fixtures in the test suite.
Evaluation criteria: Must maintain 100% rejection on reject fixtures and 100% acceptance on valid fixtures.
Published learning: If common Go idioms (e.g. temporary field projection or re-entrant map access) require excessive syntax friction that cannot be automatically inferred by the compiler, the post-mortem will document exactly where affine capabilities reach their usability ceiling in a Go-adjacent language.
Cost honesty (optional but powerful)
- Deletions: Deletes
hy-check/src/loans.rs(~1,000 lines) and simplifieshy-check/src/alias.rs. - Compiler architecture: Replaces complex retroactive graph traversals with a single forward capability ledger pass.
- Migration & UX: End users write idiomatic Hybrid code (
&andmove); the compiler infers capability lifetimes under the hood, requiring explicit capability syntax only for advanced zero-copy concurrency patterns.
Track terms
- I understand no prototype is required and failure-with-knowledge is a valid, paid outcome
- I understand all outcomes (including declines and failures) are published in MOONSHOT.md
- Lingua principale
- Rust
- Stelle
- 4
- Fork
- 18
- Merge medio
- 1g 7h
- PR unite (30g)
- 199
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di limitlessprojects/Go-Hybrid
-
[tooling] preflight can never pass: `go build ./...` runs at the repo root, which has no Go moduleForse già presa @comandanto l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
limitlessprojects/Go-Hybrid#2168 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[tooling] Example acceptance runner reports ALL PASS for an unsupported program (tested patch)Forse già presa @BP202302 l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
limitlessprojects/Go-Hybrid#1595 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[tooling] Test-registration guard certifies help-only discovery commands that execute no tests (patch + regressions)Forse già presa @Yumihariii l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
limitlessprojects/Go-Hybrid#1377 ·
I maintainer di solito rispondono entro 1 giorno
-
tools/fuzz/hyfuzz.py: unhandled UnicodeDecodeError on non-UTF-8 compiler output/corpus files, unvalidated non-executable --hyb path, and inflated case count on early abortForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
limitlessprojects/Go-Hybrid#1327 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[tooling] Preserve differential corpus reporting when builder/program execution failsForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
limitlessprojects/Go-Hybrid#789 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di limitlessprojects/Go-Hybrid
Issue simili
-
accessibility good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dividebysandwich/rust-dos#434 ·
I maintainer di solito rispondono entro 1 giorno
-
go good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno