Capability Unification & Generics Upgrade
8 sections
Overview
Replace #derive(...) with a grammar-level : structural-capability/trait clause on type declarations, so type Point: Eq, Hashable = { x: float, y: float } declares both the type and its structural capabilities in one syntax. Unify : as the single vocabulary for structural capabilities across type declarations, generic bounds, where-clauses, and supertraits; keep uses for environmental capabilities. Derive const-generic eligibility from the capability model rather than a primitive whitelist.
Planned
8 sections
Parser — `:` trait clause on type_def + `#derive` removal
Parse `type T [generics] [: trait_list] [where] = body` across struct/sum/newtype; partition declaration bounds into markers vs derivables at parse time; remove `#derive(...)`
Typeck — bound routing, supertrait enforcement, E2049
Route declaration bounds to marker / derivable / capability paths; enforce supertraits; fire E2049 Value+Drop end-to-end
Stdlib — prelude Value trait + #derive→: migration
Declare prelude `trait Value: Clone, Eq`; migrate library/std `#derive(...)` usages to the `:` clause
Const-generic eligibility via capability model
Derive const-generic eligibility from the capability model (any type `: Eq`) rather than the int/bool whitelist
Associated consts in traits (proposal Phase 4)
Implement associated consts in traits per proposal §10
Const functions in type positions (proposal Phase 5)
Implement const functions in type positions per proposal §11
Spec + grammar.ebnf sync
Sync grammar.ebnf type_def + spec to the implemented `:` declaration syntax via /sync-grammar + /sync-spec
Spec test corpus + #derive→: corpus migration
Spec tests for `:` declaration syntax + acceptance criteria; migrate test-corpus `#derive(...)` to `:`