Skip to content
Tcl Source Code Artifact [0c9f86f49f]
Login

Artifact [0c9f86f49f]

Artifact 0c9f86f49f193fc9e9b01a5bf8e638a9c517b4042f8d3ea280ba6092f124b9e8:


== un constructeur : un type connu, vérifié, jamais converti
valeur nue : prend le type         mm {}
double normalise                   1500.0 m
valeur typée, même type            mm {}
valeur typée, la base              int {}
toute valeur est une chaîne        string {}
règle : refus                      ERREUR type mismatch: the value is mm, the annotation says m (an annotation does not convert: use type cast m)
nominal sans lien : refus          ERREUR type mismatch: the value is mm, the annotation says kg (an annotation does not convert: use type cast kg)
troncature : refus                 ERREUR type mismatch: the value is double, the annotation says int (an annotation does not convert: use type cast int)
nom inconnu : refus                ERREUR unknown type "zz": an annotation on a value received by a constructor must be a known type
la conversion : type cast          m {}
argument typé, même règle          ERREUR argument "x": type mismatch: the value is mm, the annotation says m (an annotation does not convert: use type cast m)
retour typé, même règle            ERREUR return value {m}: type mismatch: the value is mm, the annotation says m (an annotation does not convert: use type cast m)
type {T} : donner un type          mm {}
type {T} ne convertit pas          ERREUR type mismatch: the value is mm, the annotation says m (an annotation does not convert: use type cast m)
== list garde l'annotation (une note)
list {mm}1500                      {} mm
list {zz}5                         {} zz
list {m}$t : ni cast, ni erreur    mm m
== un paramètre non typé : une option, lue comme note
un type connu                      {} mm
un nom inconnu                     {} zz
une étiquette                      {} /cote
rangée dans une variable locale    /cote
relais : annotated                 cote
relais : annotate                  nom
sans relais : ambigu               ERREUR value "2.0" fits variants cote and nom of forme: write {/cote}2.0, or set {forme}S(cote) 2.0
paramètre typé : constructeur      cote
== annotate, annotated
annotate T $v = {T}$v              mm {}
annotate dans list : une note      {} mm
annotate, nom inconnu              ERREUR unknown type "zz": an annotation on a value received by a constructor must be a known type
annotate {} : retirer le type      {} {}
annotate list(2).int               list(2)<int>
le premier set reçoit              ERREUR local annotation {/cote} cannot be stored by "set": it only applies between a caller and the command it calls
== note set|add|get|has|delete : des données
note set (syntaxe)                 lien.cible="https://tcl.tk",style.couleur=rouge,style.gras
la valeur est inchangée            5 {}
note has (chemins)                 1 1 0
note add                           lien.cible="https://tcl.tk",style.couleur=rouge,style.gras,style.italique
la dernière l'emporte              lien.cible="https://tcl.tk",style
note delete (une branche)          lien.cible="https://tcl.tk"
rangée par set : une donnée        lien.cible="https://tcl.tk",style.couleur=rouge,style.gras
dans un constructeur typé          int lien.cible=\"https://tcl.tk\",style.couleur=rouge,style.gras
sur une valeur typée               mm zz
note set {} : plus de note         {} {}
syntaxe fausse                     ERREUR bad notes "a,(": name expected at 2
valeur citée                       a="x,y"
== type var : le type de la variable
variable typée                     mm list<int>
variable libre, valeur typée       {} mm
variable inconnue                  ERREUR can't read "nulle": no such variable
== vues {list} {dict} : options de foreach, lassign...
foreach {list}$p                   1.0 2.0
lassign {list}$p                   1.0 2.0
dict for {dict}$p                  x y
set y {list}$p : refus             ERREUR type mismatch: the value is pt, the annotation says list (an annotation does not convert: use type cast list)
type cast list $p                  list
== notes lues dans un texte : des données
type parse                         double vitesse
élément d'une liste typée          this