[Newbie] Morph class>>new
Stephen Pair
stephen at pairhome.net
Wed Apr 16 12:58:33 UTC 2003
Cees de Groot wrote:
>On Wed, 2003-04-16 at 01:03, Richard A. O'Keefe wrote:
>
>
>> new
>> ^self basicNew initialize
>> initialize
>> "do nothing"
>>
>>then many classes would not need to define #new at all.
>>
>>
>>
>Exactly my idea. The only counter argument so far seems to be
>performance - the extra 'dummy' message send to 'initialize' on instance
>creation for *every* object, which is assumed to be expensive but
>appears to be acceptably cheap.
>
>Personally, I would vote pro this cleanup. If people find a case where
>they don't want it (for performance reasons or whatever), they're free
>to override this sensible default.
>
It sounds to me like a sensible thing to do. The only thing I'd like to
see is some measurements of the performance impact (after all, objects
are creeated at a furious pace). Then, if the performance impact is
measurable, figure out a way to optimize it to regain speed so that it
is never necessary for someone to override the default just for the sake
of performance.
- Stephen
More information about the Squeak-dev
mailing list
|