136. Gold-tier syntax: var fields, graders, local types (2026-11-21)
- Context. The gold dreams (
spec/GOLD.txt) are now the headline check; these forms stop them, and each says something the core can't yet. - Decision.
- Fields are fixed after construction unless declared
var, mirroringlet/var:struct Tally: var top = 0, var sum = 0. Assigning a non-varfield is an error naming the field. A field may be typed by its default (134).cpl fixaddsvarto every field a program assigns. - Inline modules:
mod name:with an indented body (W13). - Judge entry points:
@grader,@grader(interactive)and@grader(two_phase)on afnormodmark the functions the judge calls instead ofmain, as in IOI. Functions the judge provides are declared, not defined:extern fn transaction(m: Int) -> (List<T>, Int). The judge profile supplies the harness; local runs use a generated stub. - Types (
struct,enum,domain,type) declared inside a fn body are scoped to that block and may use its runtime domains. - A lambda body may be an indented block after a line-ending
=>; its value is the last expression (the block lambda of 98).
- Fields are fixed after construction unless declared
- Rejected.
fn f() -> T =followed by an indented block (use:);xs all in D(use.all(x => x in D));for e in xs.values_mut()(for mutwas deleted in 19.4; bindlet e = mut xs[k]). - Why.
varfields document which state moves, the wayvarlocals do; graders and extern fns are the only way to state an IOI task; local types keep helper records next to their one use. - Reverse.
varfields: drop the rule and the codemod. Graders: replace with a program-shape decision when that is designed (deferred). - Status. Accepted in the spec (
spec/delta/parser-gaps.md); not parsed yet.