[squeak-dev] Curly Braces for Multiple Value Assignment?

Bert Freudenberg bert at freudenbergs.de
Tue Mar 23 22:02:52 UTC 2010


On 23.03.2010, at 20:53, Ken Causey wrote:
> 
> http://www.cc.gatech.edu/fac/mark.guzdial/squeak/notes/curlybraces.html	
> 
> In the email archived here Mark seems to indicate that at some point you
> could use the curly brace syntax as if it were a sort of list
> comprehension.  Brian Rice pointed me toward this link as I was asking
> about idioms for variable swapping on the IRC channel.
> 
> This doesn't work in trunk as the parser doesn't like it for multiple
> reasons.  I tried it in 3.7 and the parser complains less but still
> doesn't like the := (or _) after the brace.  Is this mistranslated
> speculation by Mark or was this a feature lost eons ago?  If lost, was
> there a reason against it?  I've found myself pining for the ability to
> nicely handle returning multiple values as well as stuff like variable
> swapping that would be nicely covered (given certain assumptions about
> the implementation) by this.
> 
> Wouldn't some form of list comprehension be a nice check box for Squeak?
> 
> Ken 

The assignment was there very briefly after Dan introduced curly braces, but then he took it out. I think because it complicated the syntax too much: a left-hand-side brace array isn't actually an array but something totally different from a right-hand-side brace array. When you start parsing it you don't even know if it's going to be an assignment or not, so you don't know if you should allow expressions in there or just variables. Etc.

But I don't really remember the details.

- Bert -




More information about the Squeak-dev mailing list