Overview
| Comment: | Notes and types together Notes now follow a value at any depth: path writes (set P(y) $n), product fields (construction, $P(x), $P(x,y), $P(*)), and nested paths. Only data notes travel; a pending field label such as {point/x} stays with the constructor. type parse reads notes as data: {mm@src=capteur}1500 no longer fails. Typed collections keep their type on the way out The element type is carried once by the collection and applied when a value leaves it. Elements are not copied, and compact storage is kept. lindex, lsearch -inline, dict get and dict for give a typed element. lrange, lreverse, lsort (including -unique and -command), lsearch -all -inline and dict filter keep the collection type; dict values gives list.T. The comparison command of lsort -command receives typed values, so a {kg} parameter rejects an mm. Canonical text with modes type canonic and type parse share the options -type, -notes, -value, -deep and -list. With no option, they cover everything, at full depth. Element notes and element types under any are written as prefixes, for example {list.mm}{{{@ok}5} 7}. The round trip is exact, checked on randomly generated values. -list returns {type notes value}, ready for lassign or a tuple assignment. type parse -list splits a canonical text by syntax alone, so the type may be unknown to the reader. Reading a canonical text never executes anything. Proposed public C API: Tcl_GetCanonicObj, Tcl_ParseCanonicObj and the TCL_CANON_* flags. Behaviour change: type canonic -notes now returns the notes alone; the old meaning is -type -notes. Core conversions no longer drop annotations A typed value used as a number, a regexp, a script, a command name, an option, a subcommand, a channel, an encoding, a namespace or a clock format keeps its type and notes. Core patch: annot-conversions.patch. New loss detector: ::tcl::unsupported::annotlost or TCL_TYPE_TRACE=lost. Found along the way, a Tcl 9 bug: lsort checked getElementsProc on objv\[1\] instead of the list. Fixes In expr, x is T now agrees with type is: an mm is not a kg, even though both are built on int. An integer typed as double now prints as 7.0. Known limits A typed value used as a variable name loses its annotation. So does a value whose representation is taken over by an extension type. type parse -value on an unknown type leaves the element prefixes in place. Tests 128 script tests pass in 5 modes; valgrind finds no leaks or errors. The fuzzers give identical output across modes. In the full core suite, fileName, http11, socket and tcltest show failures that do not appear when these files run alone. The comparison run with the old version used different settings, so this is not confirmed as environment-only. Next type eval: implicit conversion inside its block, and unit algebra for * and /. |
|---|---|
| Timelines: | family | ancestors | descendants | both | tip-764_tcl90 |
| Files: | files | file ages | folders |
| SHA3-256: |
dd10cbf51b4b609947646a54ba6fc8a5 |
| User & Date: | Florentis on 2026-11-29 17:26:47.340 |
| Other Links: | branch diff | manifest | tags |
Context
|
2026-11-30
| ||
| 01:50 | vectorisation : A new func, TclExprProfile, take the tree that ParseExpr build to compile an expres... check-in: 7d560173c3 user: Florentis tags: tip-764_tcl90 | |
|
2026-11-29
| ||
| 17:26 | Notes and types together Notes now follow a value at any depth: path writes (set P(y) $n), product... check-in: dd10cbf51b user: Florentis tags: tip-764_tcl90 | |
| 04:14 | allow substitutions (var, commands) in notes check-in: 8aa7018b27 user: Florentis tags: tip-764_tcl90 | |
Changes
Modified generic/tclAnnotObj.c
from [9c52d6f24a]
to [55b57515df].
[diff]
Modified generic/tclTypePath.c
from [e9a923959c]
to [a5d6d3715a].
[diff]
Modified generic/tclTypedVar.c
from [6cf74fc910]
to [491a32960f].
[diff]
Modified generic/tclTypes.c
from [28a2836134]
to [e3d1503ab7].
[diff]
Modified generic/tclTypes.h
from [e5bcb2d9ef]
to [353d3c7e28].
[diff]
Modified typeparse/MANUEL.md
from [4cc9995eba]
to [48ce6cb1d2].
[diff]
Modified typeparse/REPRISE.md
from [d226cf2baa]
to [447c72ae82].
[diff]
Modified typeparse/VERSION
from [2b44fd78f0]
to [3da1ac0b03].
[diff]
Modified typeparse/doc/764.md
from [2603c6ddd1]
to [4412cc1fed].
[diff]
Modified typeparse/doc/ANNOTATIONS.en.md
from [fa4de730f8]
to [a7803de6b4].
[diff]
Modified typeparse/doc/ANNOTATIONS.fr.md
from [40add241b4]
to [5433af50a9].
[diff]
Modified typeparse/noyau/LISEZMOI.md
from [df7edf29ec]
to [e65730bc48].
[diff]
Modified typeparse/noyau/ORDRE.txt
from [98938a180a]
to [d1ebb07a54].
[diff]
Added typeparse/noyau/annot-conversions.patch version [b9918e3a5e].
Added typeparse/noyau/collections-typees.patch version [d57c1ff286].
Modified typeparse/tclAnnotObj.c
from [9c52d6f24a]
to [55b57515df].
[diff]
Modified typeparse/tclAnnotatedApi.h
from [3f590e1880]
to [ad1ec39dcd].
[diff]
Modified typeparse/tclTypePath.c
from [e9a923959c]
to [a5d6d3715a].
[diff]
Modified typeparse/tclTypedVar.c
from [6cf74fc910]
to [491a32960f].
[diff]
Modified typeparse/tclTypes.c
from [28a2836134]
to [e3d1503ab7].
[diff]
Modified typeparse/tclTypes.h
from [e5bcb2d9ef]
to [353d3c7e28].
[diff]
Modified typeparse/tests_tclsh/t101_chemins_caches.out
from [9e7d65540d]
to [f9b184d131].
[diff]
Modified typeparse/tests_tclsh/t110_canonic_parse.out
from [e0d9f0b354]
to [a6be7ec873].
[diff]
Modified typeparse/tests_tclsh/t110_canonic_parse.tcl
from [c3cf0e8175]
to [d04cbf589d].
[diff]
Modified typeparse/tests_tclsh/t127_type_map_type.out
from [5e9248394f]
to [c579d86bea].
[diff]
Modified typeparse/tests_tclsh/t134_type_map_in.out
from [578aa42fe2]
to [d99fe3fb09].
[diff]
Added typeparse/tests_tclsh/t135_tuple_une_passe.out version [225c77f81d].
Added typeparse/tests_tclsh/t147_notes_et_types.out version [dbe1bcb880].
Added typeparse/tests_tclsh/t147_notes_et_types.tcl version [913ad98fa0].
Added typeparse/tests_tclsh/t148_canonic_profond.out version [e7c3b43f2f].
Added typeparse/tests_tclsh/t148_canonic_profond.tcl version [0f98516bda].
Modified typeparse/tests_tclsh/t80_lappend_contrat.out
from [55b19ae02f]
to [939bffe509].
[diff]
Modified typeparse/tests_tclsh/t82_declaration_compilee.out
from [1f00892f42]
to [7cb9e3c9ae].
[diff]