[Noob] Debugging stuff with Workspace.

Peter van Rooijen peter at vanrooijen.com
Mon Mar 8 14:02:15 UTC 2004


> > Since I thought I had created a variable "tester" in the Workspace
> > so I simply wrote another line:
> >
> > tester initialize.   ( for some reason my initialize routine
> > didn't execute itself from the previous code... )
> >
> > and, to my supprise, Workspace acted as though it had never
> > heard of it!
>
> It didn't because you declared "tester" to be a temporary variable and
that
> means it is only available inside of the <doit> you execute. To get the
> behavior you want, simply don't declare "tester" as temp.

This unituitive, wrong-footing behavior by the workspaces (if you don't
declare a variable, I will do it for you, *and* I'll remember its value; but
if you do declare it, I won't remember anything about it), is indeed how
workspace variables seem to work (in other dialects too).

I think it is really unuseful behavior. If you're going to give a workspace
persistent variables, then, in my opinion, it would be much better to
reinterpret a doIt of the declaration of temporaries as simply resetting the
bindings of those variables.

I realize that this is a little bit more work for the implementor of the
workspace variables, since one can't just hook into the compile eror to
declare variables, but has to scan for a temps declaration first. Not that
it's *that* much work, though.

This small change would make workspace variables (and workspaces in general)
so much more useful.

Cheers,

Peter




More information about the Squeak-dev mailing list