Object pointers

Martin McClure martin at hand2mouse.com
Sat Mar 23 19:02:45 UTC 2002


At 4:52 PM +0100 3/23/02, Bert Freudenberg wrote:
[...]
>
>I always loved the analogy of balloons (objects) held by threads
>(references) attached to pins (variables). Balloons (objects) can have
>pins (instance variables) by themselves. Balloons can be attached to
>multiple pins at the same time (objects can be referenced by more than one
>variables), but one pin (variable) only ever holds one balloon (object). 
>Attaching a new balloon to a pin (assigning to a variable) cuts the thread
>to the balloon previously held there. If the last thread to a balloon is
>cut (the last reference is overwritten with another value) the balloon
>floats up into the sky and after a while, it gets recycled by a small
>plane sweeping the area (unreferenced objects are cleaned up by the
>garbage collector, but not immediately). This even works for a network of
>balloons (objects referencing each other): Once the last thread to a bunch
>of balloons is cut, up it goes.

That's a great visualization! The visualization I've always had for 
object space is similar, but inverted: The root object(s) are 
attached to a 'ceiling', the objects they reference are attached to 
them by strings, and changing a reference can cause a clump of 
objects to be unsupported and fall into a bottomless pit, never to be 
seen again.

I like the positiveness and buoyancy of the balloon imagery, but I'm 
not sure I can turn my view upside down after so long thinking about 
it the other way...

-Martin



More information about the Squeak-dev mailing list