Am 23.05.10 15:15 schrieb Igor Stasenko:
Do you really need to create a meta? > > If not , then you can do just: > > newClass := Rectangle clone. > newClass > superclass: Rectangle; > organization: nil; > methodDict: MethodDictionary new. Unfortunately, this doesn¹t solve the problem:
| newClass method | newClass := Rectangle clone. newClass superclass: Rectangle; organization: nil; methodDict: MethodDictionary new; setName: #MyRectangle. newClass new class name. "--> #Rectangle" newClass new class == newClass. "--> false" method := (newClass compile: 'testGhost ^42' classified: nil notifying: nil trailer: newClass defaultMethodTrailer ifFail: [nil]) method. newClass addSelectorSilently: #testGhost withMethod: method. newClass canUnderstand: #testGhost. "--> true". newClass new respondsTo: #testGhost. "--> false" newClass new testGhost. "--> Message not understood, should answer 42"
The problem is not the MetaClass (I do need it), but that the new class doesn¹t create instances of itself, which I find very, very strange. Best regards, Joachim Geidel