Design decisions

4. Control and iteration

#DecisionStatusCurrent leanDepends onWhere
4.1Blocks as expressions, match, ?Settledindentation blocks, => arms, ? on optionalsplan/17-syntax.md
4.2GeneratorsSettled, revised 2026-11-19inlined; the compiler picks push or pull per use: push for a plain for, pull for zip or when stored as Iterator<T> (so a non-recursive generator can be stored); a recursive generator where pull is needed is an error suggesting List(g); no hidden explicit stacksresearch/archive/RECOMMENDATIONS.md §2, plan/12-domains-and-sequences.md §5
4.3Sequence views, windows & searchRevised 2026-11-20 (v2.2)Imperative Deque<T> + explicit while for two-pointers (slide_until, sliding_min/sliding_max, bsearch_first_some, rotate_right, prod, floor_div deleted; MonoDeque demoted to examples/local-lib/). 6 canonical search names: bsearch_first/bsearch_last, sorted .first_ge/.last_le (sequences -> index ?Int/?D, Set/SortedBag -> ?K, Map -> ?(K, V)), linear first/find/min_by/max_by. Signed rotate_left, next_permutation/prev_permutation, xs.adjacent, a.items, sort(..., by: desc), Rng/rand/shuffle2.3, 4.2§16, §19.7, §19.9, §19.10
4.4zip of two generatorsSettled 2026-11-19push the outer, pull the inner; only non-recursive generators can be pulled4.2research/archive/RECOMMENDATIONS.md §2
4.5do: blocks & brace blocksDeleted 2026-11-20 (v2)do:, { ... ; ... }, ;, <=>, and .field shorthand deleted; indented block works directly after =>§16, research/archive/audits/subtraction-audit-1.md Cut 9
4.6Labeled breakSettled 2026-11-19break 'outer / continue 'outer§8
4.7Exhaustiveness for range patternsOpenmatch x: 0 => .., 1..=9 => .. checked against x's range type1.2
4.8Views as read-only array argumentsSettled 2026-11-20a lent row or slice is a [B]T to the callee, with no adapter; a fn that wants any indexable thing opts in with A: Indexed<V, Elem = T>; concrete [V]T parameters stay concrete3.2plan/19-index-and-lends.md §3.3, §3.5
4.9Control-flow & expression uniformityLocked v2 (2026-11-20)One inline-if (if c: a else: b), elif only, match bare Pattern => expr, if let/match expressions, for ... if, while let ... and, value-copying destructuring let (a, b) = xs[i], var (a, b) = ..., parallel (a, b) = (b, a), uniform ?T optionality, line continuation after binary ops/=/open brackets§16, research/archive/architecture/language-architecture-v2.md