On Fri, 21 Mar 1997, Rick Macdonald wrote:
> On Fri, 21 Mar 1997, Keith Dart wrote:
>
> > This is a bit off topic, but I have a quick question related to this. When
> > I create an app with vtcl that reads in variables from an external file
> > and save it, all my read-in variables are saved in the source as global
> > varibles. Is there a way to defeat this?
>
> I asked the same question recently.
>
> Still waiting for a reply! :-)
Sorry, guys. I've been delocalized for the last few days and my mailboxes
have gotten out of control. Let me take a quick shot at this.
Visual Tcl "opens" files by sourcing them. It does a couple of tricks
to "learn" of new variables and procedures by comparing before and after
the source. Saving is done by walking the widget tree, stored procedures
and special gui procedures from closed windows. It is consistent given
this process that you see the above variable behaviour.
If you source a file that contains:
set a [info vars]
then you will see a globals entry in the generated vtcl file like:
global a; set a {this that etc}
not
global a; set a [info vars]
since tcl interprets as it sources files. there are a couple of ways of
avoiding this substitution, but it requires new options in visual tcl
(which I will add) which would be vastly confusing to those not very
familiar with tcl's interpreted nature (and this not defaults).
hope this helps. it would be a nice thing to add to that FAQ thingy I
keep promising to get around to.
-stewart-