[squeak-dev] Curly Braces history (was Re: A comparative article)

H. Hirzel hannes.hirzel at gmail.com
Thu May 10 15:44:48 UTC 2012


On 5/10/12, Bert Freudenberg <bert at freudenbergs.de> wrote:
>
> On 10.05.2012, at 15:12, H. Hirzel wrote:
>
>> Thanks for the link Bert,
>>
>> <citation>
>> David N. Smith wrote:
>> Curly braces are currently used in Squeak to construct
>> runtime-evaluated collections
>> </citation>.
>>
>> The question is -- is there some more documentation than just some
>> clippings from an email correspondence.
>>
>> If I understand you correctly people 'forgot' to take them out and so
>> this syntax stayed.
>
> No, that was only true in 1997. After that it has been embraced (pun
> intended) more widely.
>
>> Is it used much?
>
> In my working image there are 111 senders of braceArray. A vanilla image has
> over 50. So yes, it is used quite a bit.
>
>> Would it be possible to deprecate this usage and
>>
>> reuse the syntax for  implementing literal dictionaries 'JSON style'?
>
>
> I see no reason for trying to partly mimic JSON in Squeak.
>
> For one, you can always use
>
> 	{#foo -> 1. #bar -> 42} as: Dictionary.

I just checked it in Squeak 4.3, Pharo 1.4, Cuis 4.0 and Amber

       {#foo -> 1. #bar -> 42} as: Dictionary.    "fine for Squeak, Pharo, Cuis"

{#foo -> 1. #bar -> 42}   gives an Array in Amber;  #as: is not understood


--Hannes

>
> Secondly, if this is too slow, the canonical way is to put the dictionary in
> a class variable.

You mean to cache it in a class variable, I assume, to avoid the
evaluation each time in the instance method.


> Thirdly, I'm pretty sure literal dictionaries have less use than both
> literal arrays and brace arrays.
>
> I wouldn't be violently opposed to adding a new syntax for literal arrays,
> but I don't really see the need, and it would have to be a new syntax that
> does not clash with the current one.

OK

--Hannes

> - Bert -
>
>
>


More information about the Squeak-dev mailing list