A FogBugz case was opened by Martin Dias.
Case ID: 10917
Title: Add method for creating anonymous classes
Status: Working On
Category: Feature
Project: Kernel
Area: Misc
Priority: 3 - Must Fix
Milestone: Pharo3.0: 30/03/2014
Assigned To: Martin Dias
URL:
https://pharo.fogbugz.com/default.asp?10917I am looking forward to remove direct references to ClassBuilder. As part of such task, I asked Igor about fixing these methods in NB, and he wants to add #anonymousSubclassOf: in class builder. I would add it in current ClassBuilder and also in Slot's one.
NBExternalArray>>
anonymousSubclassInitElementType: aTypeName
"create and initialize the anonymous subclass of me"
| newSubclass |
newSubclass := ClassBuilder new
newSubclassOf: NBExternalArray
type: NBExternalArray typeOfClass
instanceVariables: ''
from: nil. "we're not using 'self' to avoid wrong subclassing from anonymous subclass "
newSubclass initElementType: aTypeName.
^ newSubclass
and
NBExternalTypeValue class>>
getClassForType: aTypeName
"Do not confuse.! This method answers an anonymous class, a subclass of NBExternalTypeValue,
which can be used for instantiation later i.e:
floatTypeClass := NBExternalTypeValue ofType: 'float'.
float := floatTypeClass new.
float value: 1.5.
float value.
"
| newSubclass |
newSubclass := ClassBuilder new
newSubclassOf: NBExternalTypeValue
type: NBExternalTypeValue typeOfClass
instanceVariables: ''
from: nil. "we're not using 'self' to avoid wrong subclassing from anonymous subclass "
newSubclass valueType: aTypeName.
^ newSubclass
You are subscribed to this case. If you do not want to receive automatic notifications in the future, unsubscribe (
https://pharo.fogbugz.com/default.asp?pre=preUnsubscribe&pg=pgEditBug&command=view&ixBug=10917) from this case.
_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker