docs: tuple syntax cutover — Tuple(...) type, .(...) value, channel-outside-Tuple failables

Rewrite specs.md tuple/failable/pack/UFCS/grammar sections to the new
syntax, update readme.md, and refresh stale tuple references in example
header comments. Also fixes two pre-existing doc inaccuracies surfaced in
review: drop the value-discarding `;` in the tuple-return examples, and
correct the §13 function-type grammar production (optional param list +
optional trailing `!` channel). Optional semantics unchanged.

current/CHECKPOINT-LANG.md logs the cutover.
This commit is contained in:
agra
2026-06-25 18:41:22 +03:00
parent 1dfc22794e
commit 40b5fb5f7e
17 changed files with 184 additions and 103 deletions

View File

@@ -1,5 +1,5 @@
// Feature 1 — materialize a tuple from a pack via `(..xs.method)` (Decision 2:
// a pack is stored by materializing a tuple). `(..xs.get)` projects `get` over
// Feature 1 — materialize a tuple from a pack via `.(..xs.method)` (Decision 2:
// a pack is stored by materializing a tuple). `.(..xs.get)` projects `get` over
// the pack and collects the results into a real tuple value, which can then be
// stored, indexed, and (for `Box(T)`) is heterogeneous per position.

View File

@@ -1,6 +1,6 @@
// Feature 1 — TYPE-position pack projection `xs.T`. The per-element protocol
// type-arg `T` projects into a Pack of types, usable in type/signature
// positions: a tuple type `(..xs.T)` and a closure signature
// positions: a tuple type `Tuple(..xs.T)` and a closure signature
// `Closure(..xs.T) -> R`. (`T` of each element comes from its
// `impl Box(T) for <elem>`.)
@@ -17,8 +17,8 @@ impl Box(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; }
impl Box(string) for StrCell { get :: (self: *StrCell) -> string => self.s; }
impl Box(i64) for Dbl { get :: (self: *Dbl) -> i64 => self.n * 2; }
// Tuple type `(..xs.T)` — heterogeneous (i64, string), matched by the
// value-projection `(..xs.get)`.
// Tuple type `Tuple(..xs.T)` — heterogeneous (i64, string), matched by the
// value-projection `.(..xs.get)`.
snap :: (..xs: Box) -> void {
t : Tuple(..xs.T) = .(..xs.get);
print("0={} 1={}\n", t.0, t.1);

View File

@@ -1,8 +1,8 @@
// Phase 4.2 — the canonical `Combined` struct's storage layer: a generic
// struct whose field is a pack of PARAMETERIZED-protocol values,
// `sources: (..VL(Ts))` → `(VL(T0), VL(T1), …)`. Each `VL(Ti)` is a real
// `sources: Tuple(..VL(Ts))` → `Tuple(VL(T0), VL(T1), …)`. Each `VL(Ti)` is a real
// 16-byte protocol value (issue: parameterized-protocol value types), and
// `(..VL(Ts))` applies `VL` per pack element. Instantiate + whole-tuple store
// `Tuple(..VL(Ts))` applies `VL` per pack element. Instantiate + whole-tuple store
// of `xx`-erased values + per-element method dispatch all work.
#import "modules/std.sx";

View File

@@ -1,7 +1,7 @@
// Phase 6 — `c.sources = (..sources)`: materialize a pack into a
// Phase 6 — `c.sources = .(..sources)`: materialize a pack into a
// protocol-typed tuple field, erasing each concrete pack element to the field's
// protocol slot. The pack `..sources: VL` holds concrete cells; `(..sources)`
// into a `(..VL(Ts))` field `xx`-erases each to its `VL(Ti)` value.
// protocol slot. The pack `..sources: VL` holds concrete cells; `.(..sources)`
// into a `Tuple(..VL(Ts))` field `xx`-erases each to its `VL(Ti)` value.
#import "modules/std.sx";

View File

@@ -5,7 +5,7 @@
// - `$R` is inferred at the call site from the lowered mapper's closure ret,
// bound into the mono (`-> VL($R)` ⇒ `VL(i64)`, `Combined($R, ..)` ⇒
// `Combined(i64, ..)`), and folded into the mangle.
// - `(..sources)` materializes the pack into the `(..VL(Ts))` field (per-element
// - `.(..sources)` materializes the pack into the `Tuple(..VL(Ts))` field (per-element
// erase) and `mapper(..sources.get)` projects+spreads; `xx c` erases the
// generic-struct instance to `VL(i64)` via the generic impl's monomorphized
// thunk.