Semantics of Set>>new in Squeak 3.9 -- To initialize or not to
initialize?
nicolas cellier
ncellier at ifrance.com
Tue Apr 4 20:28:36 UTC 2006
OK, i put the proposed init: change in http://bugs.impara.de/view.php?id=3426
BTW, Stef is right, Array (and eventual subclasses) won't call initialize (for
speed as stated in comment).
If we want to factor implementation of new: , we can simply test for the
behavior being indexable or not and send one of the two initialize path:
Behavior>>new: n
^self isVariable
ifTrue: [(self basicNew: n) initialize]
ifFalse: [self basicNew initialize: n]
This would help deleting almost any other implementation of new: but would
cost one test at each creation. I let this responsibility to gurus.
Nicolas
Le Mardi 04 Avril 2006 22:03, nicolas cellier a écrit :
> Le Mardi 04 Avril 2006 20:47, John Pierce a écrit :
> > Hi all,
> >
> > etc...
>
> Well, a lot of indexable-like classes do implement #initialize: , and a few
> implement #init: (Set and some subclasses of it, and also SharedQueue).
>
> Sure, it would be more uniform and highly desirable to rename #init: into
> #initialize: , but that said, we can say that the initialization function
> does exist in Set (and thus Dictionary).
>
> etc...
>
> We just should rename this init: method...
>
> Nicolas
More information about the Squeak-dev
mailing list
|