Artifact faea35a15b2fcfae3fcd5ea0964c3861a7235eb2b1b4368df72a504abdddf02b:
- File typeparse/exemples/tcllib_geometry/e2e.tcl — part of check-in [83801ad6ad] at 2026-11-24 09:32:02 on branch tip-764_tcl90 — typeparse v17o: block-wise type map, path windows, views on object lists - type map: evaluated in blocks of 256 elements when the expression computes in doubles only (columns gathered, each operation applied to the whole block); flagged elements are evaluated again one by one, so results stay identical to expr. TCL_TYPE_NOBLOCK=1 to compare. - Windows $L((s0,s1,...):end:step): one column per start, same step, complete windows only, for reading and writing (set L((0,1)::2) $X $Y). - Ranges of a typed list of objects are views (shared base, start, step, count), without touching the elements; type map reads them in their base. - Typed columns are written in place (objects, cells, num), without checking the elements again. - set {T}x $v with v already of type T keeps the value as is (instead of unfolding and checking it again); fast creation of list.num. - $L(a:b:c) outside procedures uses the same direct reads as compiled code. - Fix: a fully substituted index stays a single name in the fast paths too ($L($s) with s = 1:3 looks for the element 1:3). - Tests t125, t126. New example exemples/tcllib_geometry/COMPARAISON.md: the geometry chain in ten variants, from plain Tcl to fully typed C. No core patch. (user: Florentis, size: 1418) [annotate] [blame] [check-ins using]
# e2e.tcl -- une chaîne de bout en bout : translation, rotation, puis aire, # longueur et boîte englobante, sur un polygone typé UNE fois au départ. # tclsh e2e.tcl (coordonnées double) namespace eval ::math::geometry {variable coord double} set argv {}; set argc 0 source [file join [file dirname [file normalize [info script]]] vectorise.tcl] namespace path ::math::geometry proc chaine {p V} { if {$V} { set q [translateV {3.5 -2} $p]; set r [rotateV 30 $q] list [areaPolygonV $r] [lengthOfPolylineV $r] [bboxV $r] } else { set q [translate {3.5 -2} $p]; set r [rotate 30 $q] list [areaPolygon $r] [lengthOfPolyline $r] [bbox $r] } } puts "\nchaîne : translate, rotate, area, length, bbox" puts [format "%-36s %10s %10s" variante 1000 100000] foreach {nom forme V} { "geometry.tcl, liste ordinaire" brut 0 "geometry.tcl, polyline typée" polyline 0 "type map, polyline (objets)" polyline 1 "type map, polylinec (en cases)" polylinec 1 } { set ligne [format "%-36s" $nom] foreach n {1000 100000} { set P [polygon $n 100.0] if {$forme ne "brut"} {set P [type cast $forme $P]} set r [chaine $P $V] if {![info exists ref($n)]} {set ref($n) $r} elseif {![pareil [lrange $r 0 1] [lrange $ref($n) 0 1]]} { append ligne " (ÉCART)" } append ligne [format " %8.0f µs" [best [list chaine $P $V]]] } puts $ligne }