Version 2 of info vars

Updated 2003-12-11 09:06:00

info vars ?pattern?

If pattern isn't specified, returns a list of all the names of currently-visible variables. This includes locals and currently-visible globals. If pattern is specified, only those names matching pattern are returned. The matching of pattern is determined using the same rules as for string match. Pattern can be a qualified name like Foo::option*. That is, it may specify a particular namespace using a sequence of namespace names separated by ::s, and may have pattern matching special characters at the end to specify a set of variables in that namespace. If pattern is a qualified name, the resulting list of variable names has each matching namespace variable qualified with the name of its namespace.


Question: in what cases do these two info commands differ?

  set a 1

  set b [info exists a]

and

  set c [info vars a]

The doc for info exists indicates that the variable exists and has a value in either the current or global space.

Certainly, one potential problem is if the variable has any pattern characters in it.

Are there other differences between the two?


See also:


Category Command - Tcl syntax help