A comparative article (was Re: [squeak-dev] [ANN] STON -
Smalltalk Object Notation)
Georg Gollmann
gollmann at zid.tuwien.ac.at
Tue May 8 09:11:58 UTC 2012
Am 08.05.2012 um 09:55 schrieb Göran Krampe:
> The most interesting bit of the article is perhaps my thoughts on literals in Smalltalk - would be nice to hear what people thinḱ.
Just a remark on:
> Literal arrays are quite nice but they lack the concept of “associations” and thus no simple readable way to represent a Dictionary.
There is a poor man´s solution relying on the "after:" message:
> colorMap := #($U 'blue' $Z 'blue' $D 'darkgreen' $T 'mediumseagreen' $P 'darkblue' $K 'brown').
> color := colorMap after: colorKey
Readability depends on the judicious use of white space or non functional elements.
The following example works too:
> #($U 'blue' | $Z 'blue' | $D 'darkgreen' | $T 'mediumseagreen' | $P 'darkblue' | $K 'brown')
Kind regards
Georg
More information about the Squeak-dev
mailing list
|