Comment #3 on issue 2523 by
[hidden email]: Some dynamically created
classes create instances of their superclass
http://code.google.com/p/pharo/issues/detail?id=2523The format you assign to the new class suggests that it is a compact class.
Hence the VM will instantiate the compact class at the index indicated by
the format.
`Rectangle format` yields 20614,
`MyRectangle format` should yield 134, that's what you get when you create
the subclass via the Browser.
Rectangle indexIfCompact yields 10, 10 << 11 => 20480, adding the standard
format 134 gives 20614, the format of the rectangle.
So to solve your example "simply" mask the upper 5 bytes.
`Rectangle format bitAnd: 2r11111111111` yields 134...
so there you go...
============================================================
newMeta := (Metaclass new)
superclass: Rectangle class
methodDictionary: MethodDictionary new
format:( Rectangle class format bitAnd: 2r11111111111);
yourself.
newClass := (newMeta new)
superclass: Rectangle
methodDictionary: MethodDictionary new
format: (Rectangle format bitAnd: 2r11111111111);
setName: #MyRectangle;
yourself.
...
============================================================
_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker