[GOODIE] Squeak Smalltalk: A Quick Reference (v. 0.0)

Marcus Denker marcus at ira.uka.de
Sun Dec 5 18:28:33 UTC 1999


On Sun, Dec 05, 1999 at 10:00:03AM -0500, Andrew C. Greenberg wrote:
> >Instantiating a ProtoObject currently does crash the system (that's a
> >little strong: let's say that rather that it causes the system to
> >abort deliberately) because of a recursive "message not understood"
> >error.  I personally consider this to be a (serious) bug.
> 
> Indeed, adding messages #new or #basicNew to ProtoObject class for 
> the purpose of trapping an error seems to crash (abort) the system as 
> well.
>
Of course ;-). 

"new" is defined in class Behaviour, so if you do a 

Object new

"new" has to be searched in the inheritance-hierarchy of the Metaclasses:

 Object class
  ProtoObject class
   Class
    ClassDescription
     Behaviour       <---- "new" is defined here
      Object
       ProtoObject
        nil

So overwriting "new" without calling "super new" in "ProtoObject class"
will crash the system. (because no new objects can be instatiated)
That's not a "feature" of ProtoObject, adding such a "new" to Object 
class will do the same.

>My point here is that given these fundamental differences (inability
>to instantiate an object or to add a class-side method without
>aborting), I am uncomfortable treating ProtoObject as the fundamental
>"object,"

It *is* possible to do a "ProtoObject new". But *printing* is not
possible (no #printIt). 

Playing around with this i found some *very* strange thing:

Do: (not print!):     a := ProtoObject new.  

then print:           a class

But "class" is only defined in Object(!), so an instance of ProtoObject
can't respond to this message. But it does. Very strange...

  Marcus

-- 
Marcus Denker marcus at ira.uka.de phone at home:(0721)614235 @work:(0721)608-2749





More information about the Squeak-dev mailing list