diff options
author | mlafon <mlafon@gmail.com> | 2017-05-23 22:36:27 (GMT) |
---|---|---|
committer | mlafon <mlafon@gmail.com> | 2017-05-23 22:36:27 (GMT) |
commit | 54868765b61d327129b4bf27a19342f1448a2ffd (patch) | |
tree | 9dc18283b0daea206a6782be65d3aa79b367f061 /doc | |
parent | 3cf85c6f708ffbb7aa84f1a5d91f8dd5a1f45c9a (diff) | |
download | tcl-54868765b61d327129b4bf27a19342f1448a2ffd.zip tcl-54868765b61d327129b4bf27a19342f1448a2ffd.tar.gz tcl-54868765b61d327129b4bf27a19342f1448a2ffd.tar.bz2 |
TIP#457: Update named group endingtip_457
Diffstat (limited to 'doc')
-rw-r--r-- | doc/proc.n | 29 |
1 files changed, 18 insertions, 11 deletions
@@ -151,15 +151,27 @@ Named argument are arguments defined using the \fB-name\fR or \fB-switch\fR extended argument specifiers. They have a special handling on call-site. All contiguous named arguments, called named group, are handled together, they are not required to be declared in order, can be omited or declared -multiple times. The handling of a named group is started when previous -formal arguments have been assigned. +multiple times. +.PP +The handling of a named group is started when previous formal arguments have +been assigned. Each named parameter uses a string starting with a dash character, followed by the name of the related argument. If it is not a switch argument, it is -followed by the value to assign to the formal argument. The handling of -a named group is ended if the next parameter is a multiple-elements list, -does not start with a dash or is the special \fB--\fR keyword. Remaining -parameters, except the \fB--\fR keyword if used, are then assigned to +followed by the value to assign to the formal argument. +.PP +The handling of +a named group is ended if the next parameter does not start with a dash or is +the special \fB--\fR keyword. In the case where the arguments after the named +group are all non-optional positional arguments and do not end with \fBargs\fR, +the handling of the named group will also be ended when the number of remaining +parameters will be equal to the number of the remaining positional arguments. +When the handling of named argument has been ended, remaining parameters, +except the \fB--\fR keyword if used, are then assigned to following positional arguments using the default handling. +.PP +It is recommended to explicitely use the \fB--\fR keyword if the next parameter +following the named group is a variable which may start with a dash, or if it +is an object which can be expensive to stringify. .VE .SH EXAMPLES .PP @@ -221,11 +233,6 @@ be left unset in the procedure. array set levels {0 DEBUG 1 INFO 2 WARN 3 ERROR} puts "[clock format $time] : $levels($level) : $message" } - -% log -level 2 "Warning..." -Sun Apr 23 20:29:41 UTC 2017 : WARN : Warning... -% log -timestamp 946684800 -debug -- -Y2K- -Sat Jan 01 00:00:00 UTC 2000 : DEBUG : -Y2K- .CE .SH "SEE ALSO" info(n), unknown(n) |