2026-11-04 10:46:42
— part of check-in
[f77a502eb6]
on branch tip-764_tcl90
— V16o
1. A variant whose type is a product is constructed via its fields.
```
set {segment.lien}s {cible:}$url {contenu:}$segs ;# labeled, order-independent, defaults
set {segment.lien}s $url $segs ;# positional
set {segment}s(lien.(cible,contenu)) $url $segs ;# your syntax, via the sum
set {segment}s($v.($fields)) {*}$values ;# computed
```
The first step of the path selects the variant. All paths must specify the same variant; otherwise, the error "a value of segment has one variant" is raised.
A path may also traverse a sum located within a product field: `set {P}r(n.i,m) 4 5`.
The messages refer to `segment.lien` rather than `prod<cible:string;…>`.
2. `type def NAME` without a definition returns the definition, using the `type def` syntax:
```
type def segment.lien ;# {string}cible; {list.segment}contenu
type def pt ;# {double}x ?= 0; {double}y
type def pt.x ;# double
```
The output text can be parsed back in its original form—a property verified by the test suite.
Variants of a sum are listed in their internal (sorted) order, and options such as `-strict` are not included in the definition.
(user:
Florentis,
size: 1648)
[annotate]
[blame][check-ins using]
2026-11-27 09:47:31
— part of check-in
[eacc36058b]
on branch tip-764_tcl90
—
v17z
Review of sum type notation.
- A variant of a sum is metadata, it must not appeat into the value :
If there is ambiguity to choose a variant of a sum, it must be an error.
- New commands to request variants of a sum type, or of a litteral sum :
type variant $v ?NAME? : empty for a litteral ; NAME select the variant of the value.
type variant -of T ?NAME?
type literal -of T ;
type is {sum?}T
type is {enum?}T
- New command to compare the type of a value :
type eq T1 T2 : true is types T1 and T2 are equal
type include T1 T2 : true if type T2 is included into T1
- New type 'num'
(user:
Florentis,
size: 1648)
[annotate]
[blame][check-ins using]