Process local variable and debugging

Lex Spoon lex at cc.gatech.edu
Thu Feb 7 22:21:29 UTC 2002


> 
> The problem comes when debugging. The code to set or get the pseudo
> globals involves incantations like
> 	Processor activeProcess foobleAt: wibble
> and when debugging the Processor activeProces is.... the debugger
> process. Bang, end of debugging run :-(

Ah, nice example.

Really, dynamically-bound variables aren't useful very often, but when
they are, it's a big win.  A lot of globals in Squeak, could just as
well be a dynamic variable instead: World, Display, Sensor, etc.  In
general, these variables are useful for state that is accessed from a
large number of scattered locations: without such a mechanism, you
either use a global, or you pass an extra parameter around.  (Or, you
hack Process. :) )  So, it would be nice if they were available.


On the other side, it's not *that* often that you need such a thing, and
Smalltalk is so small and simple as it is.  Maybe hacking process is a
reasonable way to go, whenever you truly desire this!


Anyway, here's a quick hack: Have "Processor activeProcess" return the
process being debugged, if it is invoked from within the debugger.  I
don't know how, but, isn't that a reasonable thing to do?  Mentally,
when you do "step" in the debugger, you are resuming the process for
just one step, even if it's not implemented that way.

It's less clear what to do about "print-it" inside a debugger....


-Lex



More information about the Squeak-dev mailing list