[squeak-dev] Re: On class/metaclass coupling
Igor Stasenko
siguctua at gmail.com
Tue Dec 8 18:20:17 UTC 2009
Here are simple example, of what powers lies beneath, yet untamed.
now, try this:
| factory instance |
factory := CustomObjectFactory new superclass: Color.
instance := factory createInstance.
{ instance class. instance class class }
prints -> an Array(CustomObjectFactory(Color) CustomObjectFactory)
btw, there are something baad with Point class. Seems like there are
interference with compact classes in VM.
| factory instance |
factory := CustomObjectFactory new superclass: Point.
instance := factory createInstance.
instance class == factory
prints ->> false
Now lets go back to original question.
The metaclass of instance of CustomObjectFactory(Color) appears to be
a CustomObjectFactory..
but i can create as many instances of CustomObjectFactory class as i want..
Or should i add 'thisClass' ivar to CustomObjectFactory? ;)
--
Best regards,
Igor Stasenko AKA sig.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CustomObjectFactory.st
Type: application/octet-stream
Size: 2140 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20091208/a070b9e2/CustomObjectFactory.obj
More information about the Squeak-dev
mailing list
|