Spec Update: Batch 11 — Compile-Time, Ownership, Modules
Date: 2026-04-16 Plans Referenced: Plan 095 (compile-time), Plan 122 (ownership trinity), Plan 131 (module paths), Plan 163 (pub keyword), Plan 167/168 (shared, pub migration) Source Files: ast/comptime.rs (HashIf, HashFor, HashIs, HashBrace), ast/store.rs (StoreKind), ast/fun.rs (ParamMode, AccessMode) Sections Updated: Compile-Time Metaprogramming (Section 18 — NEW), Ownership and Borrowing (Section 19 — NEW), Modules and Imports (Section 20 — NEW)
Old Content
No dedicated sections for compile-time, ownership, or modules existed.
New Content
Compile-Time Metaprogramming (Section 18)
#if cond { } else { }— compile-time conditional#for var in iter { }— compile-time loop unrolling#is target { pattern => body }— compile-time pattern match#{ expr }— compile-time expression evaluation- All constructs use
HashIf/HashFor/HashIs/HashBraceAST nodes
Ownership and Borrowing (Section 19)
- Trinity of Resources: view (O(1) immutable), mut (O(1) mutable), move (O(1) transfer)
- clone (O(N) deep copy) as explicit operation
- Default parameter mode: view
.holdfor lifetime extensionAccessModeenum: View, Mut, Move, Clone
Modules and Imports (Section 20)
usestatements: relative,pac.root,super.parentdepdependency declarations inpac.atpubexports for visibility- Resolution rules: file module, directory module, ambiguity error
Notes
- Compile-time constructs use
#prefix (Hash token), not to be confused with annotations#[...] #ifxis lexed asHash+Ident("ifx"), NOTHashIf— boundary check in lexer- StoreKind has 6 variants: Let, Var, Const, Shared, CVar, Field
sharedcreates process-lifetime static storage (Plan 168)