Skip to content
Tcl Source Code Check-in [289eebd31b]
Login

Check-in [289eebd31b]

Overview
Comment: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}`
Timelines: family | ancestors | descendants | both | tip-764_tcl90
Files: files | file ages | folders
SHA3-256: 289eebd31b384f5ffa9d4e9aec6b64a494add7daf790ead75d2252de4050506b
User & Date: Florentis on 2026-11-06 11:24:44.847
Other Links: branch diff | manifest | tags
Context
2026-11-06
12:35
correctif cproc pour tcc 0.9.27 windows check-in: 323b800069 user: Florentis tags: tip-764_tcl90
11:24
Complete revision of "sums" (sum types). A distinction is now made between two clearly separate cate... check-in: 289eebd31b user: Florentis tags: tip-764_tcl90
10:11
optimisation check-in: 35988e1227 user: Florentis tags: tip-764_tcl90
Changes