Artifact 41e6362d69691165d0691c416cfe63c429f4658cce08ab90219b084b22f1a53e:
- File typeparse/tests_tclsh/t55_cast_collection.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: 645) [annotate] [blame] [check-ins using]
foreach : 0,0 foreach : 3,4 lassign : 3 4 llength : 2 (le point seul : 2) dict : x=3 dict : y=4 dict for : centre=1 2 dict for : rayon=5 list : <{1 2} 5> list : {} {} list.any : <{1 2} 5> list<any> : point double list.double: <3 4> list<double> : {} {} list(2).int: <3 4> list(2)<int> : {} {} dict.any : point somme : <p {3 4}> list : {} {} poly : <{0 0} {3 4}> list<point> : point point poly nu : <{0 0} {3 4}> list : {} {} chaîne : 1 refus : expected integer but got "1 2" refus : list(3)<double> needs exactly 3 elements but got 2 refus : list(3)<point> needs exactly 3 elements but got 2 dans une procédure : 2