Artifact c35c30019cc656b976f7f5175240e4bfe65776e00984445f6eff77e32003fbd5:
- File typeparse/tests_tclsh/t64_variante_inactive.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: 585) [annotate] [blame] [check-ins using]
v(i) active 0 5 v(s) inactive 0 5 u(p) inactive 1 the current variant of U is "n", not "p", and its value "3" can't be read as pt u(p.x) inactive 1 the current variant of U is "n", not "p", and its value "3" can't be read as pt u(n) active 0 3 v(zz) inconnue 1 S has no variant "zz" set v(s) abc (écrit) 0 {s abc} S.s set u(p.x) 1 1 the current variant of U is "n", not "p": to change the variant, write the whole value ({p}...) s abc S.s p {1 2} U.p 1