Re: Issue 2523 in pharo: Some dynamically created classes create instances of their superclass

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Issue 2523 in pharo: Some dynamically created classes create instances of their superclass

pharo
Updates:
        Cc: [hidden email]

Comment #1 on issue 2523 by [hidden email]: Some dynamically created  
classes create instances of their superclass
http://code.google.com/p/pharo/issues/detail?id=2523

this looks weird... and probably important?


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 2523 in pharo: Some dynamically created classes create instances of their superclass

pharo

Comment #2 on issue 2523 by [hidden email]: Some dynamically created  
classes create instances of their superclass
http://code.google.com/p/pharo/issues/detail?id=2523

AKA all compact classes: Smalltalk compactClassesArray


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 2523 in pharo: Some dynamically created classes create instances of their superclass

pharo

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=2523

The 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
Reply | Threaded
Open this post in threaded view
|

Re: Issue 2523 in pharo: Some dynamically created classes create instances of their superclass

pharo
Updates:
        Status: Invalid

Comment #4 on issue 2523 by [hidden email]: Some dynamically created  
classes create instances of their superclass
http://code.google.com/p/pharo/issues/detail?id=2523

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 2523 in pharo: Some dynamically created classes create instances of their superclass

pharo
Updates:
        Labels: MigratedToFogBugz

Comment #5 on issue 2523 by [hidden email]: Some dynamically created  
classes create instances of their superclass
http://code.google.com/p/pharo/issues/detail?id=2523#c5

Issue migrated to https://pharo.fogbugz.com/f/cases/2571

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker