[squeak-dev] The Trunk: Collections-mt.851.mcz

Chris Cunningham cunningham.cb at gmail.com
Wed Sep 4 21:37:57 UTC 2019


Non-scientific sampling, there are many places where new sends basicNew
initialize, so the sender either wasn't aware new already did that, or
didn't trust Behaviour>>new to keep doing that.  Those can obviously just
be fixed if desired.  (Monticello code seems rife with this, interestingly).

One specifically called out "Superclasses might [do something wrong]" to
justify calling #basicNew in #new.  Many callers are class side methods
that intentionally setup the variables in subsequent calls to the instance
created by #basicNew, such as DateAndTime.

So, a mishmash of reasons.

-cbc

On Wed, Sep 4, 2019 at 2:08 PM Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com> wrote:

> Hmm, I just starred at method 'source with it' in a SpurVMMaker image and
> got
> - 252 hits for 'self basicNew';
> - 109 hits for 'super new'.
>
> So it might depend on context... This would deserve more statistics (age
> of method, initials, whether new is raising an Error or not, whether
> instance side initialize does nothing or the wrong thing, etc...)
>
> Le mer. 4 sept. 2019 à 22:38, tim Rowledge <tim at rowledge.org> a écrit :
>
>>
>>
>> > On 2019-09-04, at 12:58 PM, Thiede, Christoph <
>> Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:
>> >
>> > Thank you :)
>> >
>> > A very minor question: Would you favor [self basicNew] over [super
>> new]? It will work completely equivalently, but what is the better style?
>>
>> ^super new
>>
>> `self basicNew` will not always work equivalently. And I can almost
>> guarantee it will always do the wrong thing just when you feel sure it is
>> doing the right thing. And you will suffer Debugging Hell.
>>
>>
>> tim
>> --
>> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
>> Why use one word when two polysyllabic agglomerates will do?
>>
>>
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190904/6ca9ee58/attachment.html>


More information about the Squeak-dev mailing list