This is one of those e-mails that I know from the start to be futile, ut...
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 n unexpected place. Having played with some functional languages, I'm sed 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 hat 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 revailing idioms. I suspect it's parsable if you make the simplifying ssumption that line continuations must only have whitespace after them.