Confusion over basic Array new:

Tim Olson tim at jumpnet.com
Thu Sep 17 18:12:12 UTC 1998


>Sorry for what's probably a silly question, but I'm trying to figure out 
>why the statement:
>anArray := Array new: 10. 
>works.  Array doesn't have a class method new:.  Neither does 
>ArrayedCollection, SequentialCollection, Collection, nor Object.  So 
>where's the method that is being called on this message?

It's in Behavior.  The hierarchy for Array and Array class looks like:

Instance Protocol             Class Protocol
----------------------------------------------------------
Array                         Array class
Arrayed Collection            Arrayed Collection class
Sequencable Collection        Sequencable Collection class
Collection                    Collection class
Object                        Object class
(nil)                         Class
                              ClassDescription
                              Behavior
                              Object
                              (nil)


You can find this by doing a "spawn protocol" in the class browser pane 
when the switch is set to Class (to see the class protocol as opposed to 
the instance protocol).

     -- tim





More information about the Squeak-dev mailing list