[squeak-dev] Re: [Question] nil, true, false in array literals

Igor Stasenko siguctua at gmail.com
Wed Dec 3 19:55:50 UTC 2008


2008/12/3 Andreas Raab <andreas.raab at gmx.de>:
> Igor Stasenko wrote:
>>
>> Doesn't smalltalk stands for simplicity?
>
> Yes. But what you are proposing isn't any simpler. It is just different
> "special rules" for literal arrays. If you want it "simpler" then you would
> get rid of interpreting unbound names in literal arrays as symbols and
> rather have them require proper #symbol syntax. In other words, instead of
>
>  #(1 2.0 true false 'string' foo bar baz)
>
> you would say:
>
>  #(1 2.0 true false 'string' #foo #bar #baz)
>

I am all with you. One way, or another it makes syntax non-ambiguous.
That's all i'm actually care of.
One more reason to do this way is that if you treat any identifier as
symbol in literal array, then you don't have a way to put a nil, true,
false into it.

> in which case you might even be able to get rid of {} since now there is a
> perfectly reasonable interpretation of:
>
>   | date time |
>   date := Date today.
>   time := Time millisecondClockValue.
>  ^#(date time)
>
> and the current (static) literal array implementation would be an
> optimization for the case of no dynamic bindings in the contents of the
> literal array.
>

Or, following your idea, if compiler sees any identifier in array
literal, then array should be built dynamically at run time.
Again, i like it, because it doesn't affect the meaning of
identifiers/names depending on context, so its not ambiguous.

> Cheers,
>  - Andreas
>

-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list