Overview
| Comment: | V15q `type def {-compact}T`, `type is {compact?}`, and `type {c!}export` are now in place, following the chosen design—this is version v15q, available in `typeparse.zip`. `type is {compact?}polygone` checks the type, while `type is {compact?}$P` checks the value. I did not need to modify local annotations for value-based checks; the value retains only its content, which is precisely what holds the underlying data cells. tcl type def {-compact}polygone list.point set {polygone}P {0 0} {4 0} {4 3} ;# {0.0 0.0} {4.0 0.0} {4.0 3.0} type is {compact?}polygone ;# 1: the type requires it type is {compact?}$P ;# 1: the value is stored in cells string length $P; type is {compact?}$P ;# still 1 type {c!}export point ;# the C header (replaces `type c`) Normalization upon construction: `0` becomes `0.0`, and `0x10` becomes `16`. A `double(32)` is rounded to a `float`: `0.1` becomes `0.10000000149011612`. This normalization also applies to `set P(i.x)`, `lset`, and `lappend`. Conversions on a copy: core string and byte functions now operate on a string copy, maintained alongside the data cells. This is implemented via the new kernel patch `compact-conversions.patch`, which modifies `tclStringObj.c` and `tclBinary.c`. `tcl::unsupported::content` returns a copy that shares the same underlying data cells. This also applies to the global switch: in v15p, `string length $P` would break the compact form, but that is no longer the case. The following are disallowed in a definition: a type that is not a list of fixed-size elements (the definition is discarded, and the name remains available); an unknown option; `{-compact}` applied to an alias; a parameterized family (which I have not yet implemented). Export: `{llvm!}export` returns "not available yet," and an export without a target—or with an unknown target—is rejected. I discovered a flaw along the way: `string reverse` could modify the content of an annotated value in-place. This is no longer the case. A limitation regarding the `is` type check: if the text of a value also happens to be a type name (a value that is literally a type name), the query is interpreted as a type check. I have noted this in the planning. Tests against v15p: All expected outputs pass, with the exception of `t70_compact.out`; I have regenerated it because `string length` now maintains the compact format there. All tests and examples yield the same output, regardless of whether `TCL_TYPES_COMPACT=1` is set. The Tcl `string*`, `binary`, `stringObj`, `utf`, `dict`, `lset*`, and `list*` test suites show 3,482 passes out of 3,579, with 97 skipped and zero failures—consistent with v15. `valgrind` (PURIFY build) reports no issues for `t70_compact`, `t71_type_c`, and the new `t72_compact_type`. |
|---|---|
| Timelines: | family | ancestors | descendants | both | tip-764_tcl90 |
| Files: | files | file ages | folders |
| SHA3-256: |
7952bb10287f9e5b137be8e08f0738bf |
| User & Date: | Florentis on 2026-10-24 04:37:06.532 |
| Other Links: | branch diff | manifest | tags |
Context
|
2026-10-24
| ||
| 09:52 | Version v15s is included in typeparse.zip: the annotated scope execution time drops from 163 ms to 4... check-in: 9ac2319e26 user: Florentis tags: tip-764_tcl90 | |
| 04:37 | V15q `type def {-compact}T`, `type is {compact?}`, and `type {c!}export` are now in place, following... check-in: 7952bb1028 user: Florentis tags: tip-764_tcl90 | |
|
2026-10-23
| ||
| 16:08 | The three points are complete: this is version v15p, found in `typeparse.zip`. Along the way, `valgr... check-in: 40e39579b9 user: Florentis tags: tip-764_tcl90 | |
Changes
Modified generic/tclAnnotObj.c
from [2ca15dee68]
to [64d52d45c8].
[diff]
Modified generic/tclBinary.c
from [a721a932ce]
to [f2b6687ab3].
[diff]
Modified generic/tclStringObj.c
from [ef9ef9349f]
to [13c8590a9d].
[diff]
Modified generic/tclTypes.c
from [0c60184813]
to [36f976ecf9].
[diff]
Modified generic/tclTypes.h
from [23a3ed9d58]
to [3aae820fed].
[diff]
Modified typeparse/doc/ANNOTATIONS.fr.md
from [f3f45098b9]
to [65142c1a2c].
[diff]
Modified typeparse/exemples/geometrie/LISEZMOI.md
from [4aefe9c768]
to [aa2f16f5dc].
[diff]
Modified typeparse/exemples/geometrie/geo.c
from [56056eec4a]
to [b69f1d6db3].
[diff]
Modified typeparse/exemples/geometrie/geo_types.h
from [a3cf44aa24]
to [ff4ec8fd8a].
[diff]
Modified typeparse/exemples/geometrie/geo_types.tcl
from [a4caba934c]
to [521b8bca3b].
[diff]
Modified typeparse/noyau/LISEZMOI.md
from [5a7041a492]
to [6ab343e718].
[diff]
Modified typeparse/noyau/ORDRE.txt
from [c28e02fb38]
to [6040ce727b].
[diff]
Added typeparse/noyau/compact-conversions.patch version [eec8851e8b].
Modified typeparse/tclAnnotObj.c
from [2ca15dee68]
to [64d52d45c8].
[diff]
Modified typeparse/tclTypes.c
from [0c60184813]
to [36f976ecf9].
[diff]
Modified typeparse/tclTypes.h
from [23a3ed9d58]
to [3aae820fed].
[diff]
Modified typeparse/tests_tclsh/t70_compact.out
from [4b0693dd9f]
to [a5f8be491c].
[diff]
Modified typeparse/tests_tclsh/t71_type_c.out
from [0f1ed6f91a]
to [e25ed8313a].
[diff]
Modified typeparse/tests_tclsh/t71_type_c.tcl
from [998779dc79]
to [2275cca4d4].
[diff]
Added typeparse/tests_tclsh/t72_compact_type.out version [603c889de5].
Added typeparse/tests_tclsh/t72_compact_type.tcl version [3bcbf758e5].