Artifact eaab775e2ccc03d0b4cbce82ee7a158221db600b631a9fef0187246a68470764:
- File typeparse/noyau/ORDRE.txt — part of check-in [1508c3d76a] at 2026-11-05 08:59:55 on branch tip-764_tcl90 — Version 16p adds a field to the `Proc` structure. It allows for the typing of both the return value and the arguments of procedures. Example: tcl proc {pt}decale { {pt}p; {double}dx ?= 0; {double}dy ?= 0 } { set {pt}q [expr {$p(x) + $dx}] [expr {$p(y) + $dy}] return $q } set {pt}a 1 2 decale $a 1 1 ;# positional decale $a {dy:}5 ;# positional, followed by labels decale {dy:}5 {p:}$a ;# labels only, in any order Arguments Fields: Each field becomes a local variable subject to its defined contract. Defaults: `?= v` or `?= [cmd]`—evaluated at each procedure call; it may reference preceding fields. Remainder: A final field, `{list.T}args`, collects any excess arguments, each of which is validated. Automatic `upvar`: `{var.T}n` binds `n` to a variable in the callers scope, with its current value being validated. Call-site labels: Positional arguments following a label are disallowed; providing the same field twice or using an unknown label will also result in an error. Exception: If the target field is a sum type, the label selects the specific variant (e.g., `ps {s:}abc`). Messages: These take forms such as `wrong # args: should be "decale p ?dx? ?dy?"` or `argument "dx": expected floating-point number but got "abc"`. Return Value Cast: `proc {T}name` casts the result of a standard `return` to type `T`. Errors, `break`, `return -level 2`, `tailcall`, and `yield` are not subject to this cast. Local annotation: `return {U}$x` simply attaches an annotation, which expires when the procedure terminates. There is, therefore, no type overlapping (or "cumulation" of types). Tags: When a return value is a sum type, `return {point:}$z` selects the specific variant, and a strict sum type (`-strict`) mandates it. Using a tag that is not a valid variant, or applying one to a return value that is not a sum type, results in an error. Introspection and compatibility `type proc name returns args {…} return T`—`info args` and `info default` can "see" the fields. A valid Tcl list remains a standard list of arguments. An initial attempt caused the `proc-old-5.4` test to fail (due to an unclosed brace); this has been fixed, and the standard error is now correctly returned. Performance cost: A call with 3 arguments takes 1.2 µs, compared to 0.6 µs for an equivalent standard procedure. The return-type cast incurs no overhead if the value is already of the correct type. See next commit for complements (user: Florentis, size: 1406) [annotate] [blame] [check-ins using]
# Patchs C à appliquer sur l'arbre, dans cet ordre (un par ligne, # = commentaire). # maj.sh détecte seul ceux qui sont déjà appliqués. Les nouveaux patchs s'ajoutent à la fin. # C patches to apply to the tree, in this order. maj.sh detects the ones already applied. types-binaires-linkdepth.patch types-binaires-referentiel.patch types-binaires-taille-dynamique.patch types-binaires-annotations-locales.patch types-binaires-type-binary-annote.patch types-binaires-nom-type-binary.patch types-binaires-set-annotation-locale.patch types-binaires-notes.patch types-binaires-notes-typeget.patch types-binaires-cast-constructeur.patch types-binaires-convert-famille.patch types-binaires-codec-c.patch types-binaires-codec-c-decode.patch types-chemins-construction.patch types-chemins-depliage.patch index-chemins-noyau.patch types-chemins-atomes.patch types-produit-etiquettes.patch contrat-par-nom.patch elements-atomiques.patch cast-collection.patch eias-string-is.patch chemins-modification.patch set-nom-substitue.patch lset-reference.patch tip759-memoire.patch compact-conversions.patch procedures-typees.patch boucles-typees.patch expr-nombres-types.patch donnees-interp.patch expr-declaration-champs.patch expr-tuple.patch expr-champs-bits.patch set-type-local-compile.patch jeton-annot-2048.patch cast-immediat-etiquettes.patch piste-b-expiration.patch annot-fallthrough.patch procs-typees.patch