From: Florian Frank Date: 2005-08-05T22:44:17+09:00 Subject: Re: new block notation (was: Re: ruby-dev summary 26468-26661) On 2005-08-05 11:44:23 +0900, Florian Gro?? wrote: > I really don't understand the idea behind x = ->(a, b) { ... } -- it > makes as much sense as x = ^^(a, b) { ... } to me so I would like if > it would not replace the anonymous functions or blocks I use so > frequently. At first I rejected the syntax, too. But after thinking about it for a while, it made some sense: if you see -> as a shortcut for "function"" and as a operator that creates a lambda expression with the bound variables a, b and the body { ... }. If lambda would have been made a special form instead of a method call, it could have been lambda(a, b) { ... } as well. I still like { a, b = 5 -> a ** 2 + b ** 2 } better and think it's more similar to the older {|| } syntax. (I don't know if there are any parsing problems with this syntax.) It's also slightly less confusing in more complex cases. Compare foo(->(x){ 2 * x }) &->(y){ 3 * y } to foo({ x -> 2 * x }) &{ y -> 3 * y} If the ->() syntax stays, we should get used to cartoon character swearing jokes like Perlers had to. ;) -- Florian Frank