[squeak-dev] List syntax

Michael van der Gulik mikevdg at gmail.com
Tue May 20 09:42:59 UTC 2008


On Thu, 15 May 2008 09:42:38 +0200
Paolo Bonzini <bonzini at gnu.org> wrote:

> Jason Johnson wrote:
> > On Wed, Mar 5, 2008 at 10:23 PM, David Mitchell
> > <david.mitchell at gmail.com> wrote:
> >>  Brace notation for dynamic arrays!
> > 
> > So instead of:
> > 
> > dictionary := { $a -> 1. $b -> 2. $c -> 3 } asDictionary.
> > 
> > I need to type:
> > 
> > dictionary := Dictionary new
> >                        add: $a -> 1;
> >                        add: $b -> 2;
> >                        add: $c -> 3;
> >                        yourself.
> > 
> > ?  In my opinion the other dialects should adopt this or propose
> > another way of doing it.


Here's another way of doing it. See the attached change set (released under the MIT license; both lines of it :-) ).

It lets you do:

'one',, 'two',, 'three' "an OrderedCollection('one' 'two' 'three')"

($a -> 1),, ($b -> 2),, ($c -> 3) "a Dictionary($a->1 $b->2 $c->3 )"


Gulik.

-- 
Michael van der Gulik <mikevdg at gmail.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ListSyntax.2.cs
Type: application/octet-stream
Size: 1184 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080520/3bd5fb98/ListSyntax.2.obj


More information about the Squeak-dev mailing list