[squeak-dev] The Inbox: Kernel-fbs.695.mcz

Frank Shearar frank.shearar at gmail.com
Fri Jun 8 12:58:18 UTC 2012


On 8 June 2012 12:42, Bert Freudenberg <bert at freudenbergs.de> wrote:
>
> On 08.06.2012, at 13:00, Frank Shearar <frank.shearar at gmail.com> wrote:
>
>> On 8 June 2012 08:57, Stéphane Rollandin <lecteur at zogotounga.net> wrote:
>>>> * Use the canonical Array empty rather than #();
>>>
>>>
>>> What's wrong with #() ?
>>
>> Nothing hugely. I made the change because I remembered Chris Muller's
>> earlier statement about using a canonical instance. I like canonical
>> instances.
>
> If we think a canonical instance is preferable, then we should change the compiler. IMHO, "Array new" adds unnecessary clutter over "#()".
>
> FWIW, I'd call #() canonical, whereas "Array empty" is decidedly not part of the Smalltalk canon.

If it's an issue, I'll just resubmit with #(). It's not worth arguing about.

I had _assumed_ that #() was not canonical (because I could see not
reason for it to _necessarily_ be canonical, and Chris Muller's
comment on "Array empty", but if the Compiler does enforce that then
I'd be happy with #(). It's nicely visual. Certainly "#() == #()" is
true, but I didn't assume that two methods that each use #() would use
the same instance:

Object subclass Foo.
Foo >> #foo
  ^ #()

Foo >> #bar
  ^ #()

Foo new == Foo new bar "=> "false"

So... I guess Compiler doesn't use a canonical empty array, and maybe
it should. At any rate, that's well outside this commit's scope.

frank

> - Bert -
>
>


More information about the Squeak-dev mailing list