Artifact 39f1015f46a1ac5df3f01192fb0b2bfb165919c66cf7621aa7d7957d414ab3b4:
- File typeparse/tests_tclsh/t18_elements_types.out — part of check-in [289eebd31b] at 2026-11-06 11:24:44 on branch tip-764_tcl90 — Complete revision of "sums" (sum types). A distinction is now made between two clearly separate categories: "unions," where the specific variant can be reliably inferred from the structure of the data string, and "sums," where the structure of the data string is insufficient to definitively determine the variant. A new syntax for unions has been introduced, now utilizing the `|` symbol. E.g.: `type def matrix {{list(3).list(3)}matrice3x3 | {list(2).list(2)}matrix2x2}` Any ambiguous union will be rejected during construction, triggering an error message. "Sums" now function like "tagged unions" in C—that is, they consist of a union paired with a tag. Consequently, one must reference the tag to identify the specific variant. Sums are always written using commas (`,`). E.g.: `type def Temperature {{double}celsius, {double}farenheit}` (user: Florentis, size: 823) [annotate] [blame] [check-ins using]
ok: foreach list.int ok: lindex list.int ok: lmap list.int ok: L ok: variantes foreach ok: L(2) garde la balise ok: lindex L 2 ok: union, sans balise ok: refus {i:}abc ok: refus Val.zz ok: set {Val.s}w 7 ok: {Val}{Val.i} ok: type get élément string ok: Q(0) ok: lindex Q 2 1 ok: Z ok: modif lset ok: après lset ok: lset refus ok: lindex R 2 1 ok: R reste typée ok: R(0) ok: lindex K 0 0 ok: K reste typée ok: list nue : 5 mots ok: list.string type ok: list.string llength ok: list.string : 2 écritures ok: élément atomique ok: lindex S 1 1 vide ok: lindex S 1 ok: string range sur élément ok: list <- list.string ok: list.string <- list ok: is list.string ok: is list ok: double boucle : type conservé ok: triple boucle : atomique ok: 5 niveaux : atomique ok: lindex D 1 0 0 ok: lindex D 1 0 1 ok: lmap atomique