From: Nathan Weizenbaum Date: 2008-05-01T12:46:07+09:00 Subject: Re: lambda, ->, haskell, and so on I agree, I prefer this syntax. Although I'd prefer being consistent with the Haskell convention (and maybe other languages with similar syntax) of discouraging a space between the backslash and the first variable name. Dave Thomas wrote: > This is one of those e-mails that I know from the start to be futile, > but... > > For a while now, the > > -> (params) { block } > > syntax in Ruby 1.9 has bothered me, but I've never been sure why. > Today, while playing with pure, it struck me. The '->' sequence is in > an unexpected place. Having played with some functional languages, I'm > used to lambdas being written > > \ params -> block > > That is, the lambda is introduced with a \ (because, presumably, it > looks a bit like ��). The -> sequence separates the parameters from the > block. This had become ingrained into be, in the same way that the > equals sign in an assignment > > a = expression > > goes between the lvalue and the rvalue. > > So, when I come to Ruby 1.9, suddenly there's some dissonance between > what I was used to and what I now have to type. The -> comes before > the parameters, not after. It's as if I had to write assignments > > = a expression > > So, here's the futile part... :) > > Is it too late for Ruby 1.9 to support lambdas that look like > > \ p1, p1 -> { block } > > I honestly feel this would be more natural, and more in line with the > prevailing idioms. I suspect it's parsable if you make the simplifying > assumption that line continuations must only have whitespace after them. > > > > Dave >