Luc <
n...@no.no> wrote:
> proc p.printfiles argNumber {
> .t delete 1.0 end
> .t insert end ::file_$argNumber
> .t insert end "\n"
> .t insert end "parray: [parray ::file_$argNumber]"
> .t insert end "[set ::file_[set argNumber](size)]"
> parray ::file_$argNumber
> }
>
> And the plot thickens. If I include [info vars] in those insert
> lines, the only var it finds is argNumber. What about the global
> vars? Where are they?
As no one has yet answer this, I'll add.
The reason 'info vars' only shows argNumber is because this is how
'info vars' is defined to behave:
man n info:
info vars ?pattern?
If pattern is not specified, returns a list of all the
names of currently-visible variables. This includes
locals and currently-visible globals. ...
Do recall that in Tcl, global variables are not visible inside proc's
by default. Since your proc has a single arg (argNumber) and no calls
to "global" to make any globals visible, the only 'currently-visible
variables' inside the proc is the single 'argNumber'.
If you want to see all the globals, you have to ask for all the
globals:
man n info:
info globals ?pattern?
If pattern is not specified, returns a list of all the
names of currently-defined global variables. Global
variables are variables in the global namespace. ...
You want 'info globals' if you want to see all the globals from inside
a proc.