Newbie Question: How to manage instances?

Peter Hora HoraPe at ROYALST.training.wa.gov.au
Tue May 25 04:28:32 UTC 1999


You may want to create a global variable for your album:

Smalltalk at: #Album put: Set new.

>>> "Peter Smet" <peter.smet at flinders.edu.au> 05/25 8:52 am >>>
11 timesRepeat: [ album add: (Track new)].
Should do the trick.

    -----Original Message-----
    From: Tim Cuthbertson <timcuth at bellsouth.net>
    To: Squeak Mailing List <squeak at cs.uiuc.edu>
    Date: Tuesday, May 25, 1999 9:50 AM
    Subject: Newbie Question: How to manage instances?
    
    
    If I create an instance, e.g.,
        aTrack := Track new
    and then create another instance, again using
        aTrack := Track new
    is there any way to get to the first instance, again? If so, how?
    
    Suppose I created eleven instances of Track and then wanted to add them to an instance of Album, a subclass of Set. Even if I used eleven different temp variables to hold references to each Track, I am now faced with a similar problem for my instances of Album. If I don't retain the temp variable I used when I created it, I don't understand how to find it, again.
    
    I hope this makes sense. Thanks for any help.
    
    Tim





More information about the Squeak-dev mailing list