Artifact 34f38c8418715eabafa38a5478c2cb8a0570d9f5a525e18e6353594759d1b08a:
- File typeparse/tests_tclsh/t99_produits_ouverts.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: 892) [annotate] [blame] [check-ins using]
--- produit : la vue liste de ses champs llength : 2 2 lindex : 1 double lassign : 1 2 foreach x y : 1 2 {*} : 2 concat : 1 2 1 2 / 1 2 1 2 join : 1,2 lmap : 2 4 même structure après la chaîne : 2 2 2 --- écritures par la vue liste (sous contrat) lset : 5 2 point lappend : 1 point needs 2 values but got 3 P : 5 2 --- chaînes atomiques list.string : <hello world> 1 string list.string : <coucou> 1 string imbriquée : <hello world> 1 imbriquée : <a> 1 imbriquée : <b> 1 imbriquée : <c> 1 string : 1 --- champ chaîne d'un produit llength : 2 1 string champ : <hello world> 1 champ : <3> 1 --- sommes, listes de produits somme : 2 1 list.point : 2 point 2 concat {*} : 1 2 3 4 produit mixte: 2 3 1 --- retour typé vers un appelant non typé lassign : 3 4