Squeak 3.8/3.9 and Behavior class new
Alexandre Bergel
Alexandre.Bergel at cs.tcd.ie
Sun May 14 11:04:16 UTC 2006
> You would like to have
>
> Behavior>>new
>
> ^ self basicNew initialize.
>
> Behavior>>initialize
>
> self methodDictionary: self emptyMethodDictionary.
> self superclass: Object.
> self setFormat: Object format.
> ^ self
I just tried and it works. I also tried to break it when creating
subclasses, but I was not successful.
Let's assume a class A, for which:
A class>>initialize
" do nothing"
I was wondering why I can still create a subclass of A.
Actually, when a subclass is created, Behavior>>new is called on the
class Metaclass. Then, this instance of Metaclass is initialized with
a superclass and an empty dictionary
(ClassBuilder>>privateNewSubclassOf:)
Interesting...
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.cs.tcd.ie/Alexandre.Bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
More information about the Squeak-dev
mailing list
|