On Dec 3, 2013, at 11:20 AM, Clément Bera <[email protected]> wrote:
> Then for your project replace ProtoObject by StubRootClass in > UndefinedObject>>subclass:instanceVariableNames:classVariableNames:poolDictionaries:category: > it will work. yes but this is ugly because I do not want override. So I will introduce an exception so that we can do that in a clean way. > An alternative is to catch OCSemanticWarning or its subclass > OCUndeclaredVariableWarning while loading the new classes and execute another > code instead of the default action in the exception handling block do you know if the OCUndeclaredVariable is raised for unknown superclass? How to undefined and OCUndeclaredVariableWarning relate? Stef > > > 2013/12/3 Stéphane Ducasse <[email protected]> > > 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 >
