[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] Symbols in array literals
From: |
Mike Anderson |
Subject: |
Re: [Help-smalltalk] Symbols in array literals |
Date: |
Sat, 24 Feb 2007 17:31:57 +0000 |
User-agent: |
Thunderbird 1.5.0.8 (X11/20061025) |
Paolo Bonzini wrote:
> Mike Anderson wrote:
>> I would really like to be able to dispense with the # in front of
>> symbols in array literals. In other words, I would like the following to
>> be valid:
>>
>> #(1 two nil)
>
> I'm not very happy about this. There's no reason, then, why #(nil)
> should answer nil rather than #nil. I can make it give a warning if you
> need compatibility, but I'd rather avoid fully backing the #(one two
> three) syntax.
The reason is that true, false and nil are special variables; they are
the only variables that you can include in an array literal. For that
reason, they hide the symbols #true, #false and #nil. To formulate it
another way, variables always hide symbols of the same name, but as it
happens, there are only three that are allowed.
Still, I'm not too bothered; it's part of the virtue of Smalltalk that I
can load STInST and have it work the way I'd prefer (although in
practice I might patch the VM).
Mike