Newbie question - watching variables

Stephen Pair spair at acm.org
Sat Aug 25 03:29:11 UTC 2001


This can be troublesome if it's a very commonly used class (i.e. if you
wanted to know when the x component of a Point was ever
changes...putting a halt in those methods would likely not be a viable
solution).  In that situation, you will need to change the behavior of
the particular instance in question.  One way to do that is to create a
special class for just that instance (usually a subclass of the
instance), then change the class of your instance (or #become: it with a
new instance of the special class).

- Stephen

> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org 
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On 
> Behalf Of Anthony Hannan
> Sent: Friday, August 24, 2001 9:27 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Re: Newbie question - watching variables
> 
> 
> Kyle Bygott <Henry.Bygott at colorado.edu> wrote:
> > Is there some way to set a watch on a variable such that when 
> > something attempts to change the variable it halts and lets you see 
> > whats going on?  I've got something changing a variable 
> somewhere in 
> > my code but can't track it down for the life of me.
> 
> I would just insert a 'self halt.' before every assignment to 
> it.  You can find all assignments to inst vars by selecting 
> 'inst var defs...' off the class menu in the browser.  You 
> can find assignments and references to class vars by 
> selecting 'class var refs...'.  And you can find assignments 
> and references to global variables by selecting the variable 
> name (anywhere, like in a workspace) and hit Alt-Shift-n.
> 
> 





More information about the Squeak-dev mailing list