Sujet : Re: where is the TCL "macro" command ?
De : ralfixx (at) *nospam* gmx.de (Ralf Fassel)
Groupes : comp.lang.tclDate : 28. Jun 2024, 08:23:30
Autres entêtes
Message-ID : <ygar0chttsd.fsf@akutech.de>
References : 1 2
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
* aotto1968 <
aotto1968@t-online.de>
| should be
>
| proc block {args code} {
| ...
| }
>
| "args" always collect as much as possible arguments
| { args code } first set the defined "code" from the "end" and
| all remaining arguments got to "args"
Note that the TCL 'args' works differently: it is only 'magic' if it is
the *last* entry in the argument list.
https://www.tcl.tk/man/tcl8.6/TclCmd/proc.htm(*emphasis* added by me) :
There is one special case to permit procedures with variable numbers of
arguments. If the *last* formal argument has the name “args”, then a
call to the procedure may contain more actual arguments than the proce-
dure has formal arguments. In this case, all of the actual arguments
starting at the one that would be assigned to args are combined into a
list (as if the list command had been used); this combined value is as-
signed to the local variable args.
HTH
R'