From: "David A. Black" Date: 2008-05-09T01:04:29+09:00 Subject: Re: lambda, ->, haskell, and so on Hi -- On Fri, 9 May 2008, ara.t.howard wrote: > > On May 8, 2008, at 9:35 AM, David A. Black wrote: >> The arrow really looks weird there, since it's not pointing to >> anything but looks all the more like it is (since there's something on >> the left). > > i'm confused: in what way is this 'not pointing to anything' > > > > irb(main):013:0> def pointed(opts) opts[:before].call end > => nil > > > irb(main):014:0> pointed before: -> { p 42 } > 42 > => 42 Because if the arrow means "I'm pointing", then the {} should be a hash. Of course one can describe that one case as "symbol: plus arrow pointing to curly braces which mean a lambda in this context", but the problem is that the presence of an arrow *in that one case* is just serendipitous. It still leaves you with: my_method(str: "hello") where suddenly the logic of "pointing from the symbol to the object" has vanished. Also, I believe -> was chosen because it's supposed to look like a sideways lambda, not because it looks like an arrow. Unfortunately it looks like an arrow. Again, the oddness of the special-case non-arrow-arrow in argument lists wouldn't be a deal-breaker for me if I had no other problem with the ->(){} syntax, but I'm not a fan of it in general. David -- Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS June 9-12 Berlin ADVANCING WITH RAILS June 16-19 Berlin INTRO TO RAILS June 24-27 London (Skills Matter) See http://www.rubypal.com for details and updates!