Lazily-evaluating Squeak objects

Brian Rice water at tscnet.com
Tue Jun 8 09:14:30 UTC 1999


>You don't need to use dictionary.
>
>Suppose you need to build two objects, A and B, and each
>needs a reference to the other.  You create one (say A)
>and then the other.  When you create B, you can pass in
>a reference to A, so you can ensure that you never have
>a B without an A.  However, for a short while you will
>have an A without a B.  This is not a problem, because
>it doesn't last long.
>
>Often I make a Builder object that creates both A and B
>and ensures that they point to each other.  Outside the
>Builder, I never see an uninitialized object, so the
>builder hides the initialization.
>
>-Ralph Johnson

So, you suggest to basically construct a "wrapper" object, B, for the
reference variable(s) of the object A, and then to use the Builder
encapsulation of initialization as necessary?  The logic makes sense.

It also would seem to work for the general case where reference variables
may be changed to refer to self instead of another object.  Well, I'll try
this out and test the results.

Thank you,
    Brian Rice





More information about the Squeak-dev mailing list