info default
Tells if an argument of a proc has a default value, and gives it.
info default PROC ARG VAR
Description
Gives 1 when the argument ARG of the proc PROC has a default value, and sets the variable VAR to that value. Gives 0 when ARG has no default, and then sets VAR to an empty string. An ARG that is not an argument of PROC is an error.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| PROC | proc name | required | The proc. |
| ARG | argument name | required | The argument of the proc. |
| VAR | variable name | required | The variable that gets the default value. |
Returns
1 or 0.
Examples
% proc f {a {b 2}} {}; list [info default f b v] $v
1 2
% proc f {a {b 2}} {}; list [info default f a v] $v
0 {}
Errors
% proc f {a} {}; info default f zz v
procedure "f" doesn't have an argument "zz"
-errorcode NONE
% info default set a v
"set" isn't a procedure
-errorcode NONE
% info default f
wrong # args: should be "info default procname arg varname"
-errorcode TCL WRONGARGS
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1