[Pharo-dev] Opal hook?

Stéphane Ducasse stephane.ducasse at inria.fr
Tue Dec 3 04:19:29 EST 2013


> Well if the class does not exists it calls the method on UndefinedObject (UndeclaredBinding). And you have:

I will check and see if I can set up a hook because having classes subclasses of protoobject is not a good idea 
when loading broken code.

> UndefinedObject>>subclass: nameOfClass  
> 	instanceVariableNames: instVarNames
> 	classVariableNames: classVarNames
> 	poolDictionaries: poolDictnames
> 	category: category
> 	"Calling this method is now considered an accident.  If you really want to create a class with a nil superclass, then create the class and then set the superclass using #superclass:"
> 	self traceCr: ('Attempt to create ', nameOfClass, ' as a subclass of nil.  Possibly a class is being loaded before its superclass.').
> 	^ProtoObject
> 		subclass: nameOfClass
> 		instanceVariableNames: instVarNames
> 		classVariableNames: classVarNames
> 		poolDictionaries: poolDictnames
> 		category: category
> 
> The best is to set manually the superclass after with #superclass:

No because I have no idea what are the classes whose superclasses are not in the image.
With a proper hook I could just say
	if the superclass is unknow please use the "StubRootClass" of my framework.
	else let the system handles it.

Stef



More information about the Pharo-dev mailing list