From: _why Date: 2008-05-23T02:56:22+09:00 Subject: Re: lambda, ->, haskell, and so on On Tue, May 20, 2008 at 01:54:17PM +0900, ara.t.howard wrote: > On May 19, 2008, at 11:23 AM, Yukihiro Matsumoto wrote: >> There could be a chance for the keyword like "fun" or "fn", but >> there's little hope. > > i really think the path of least resistance and easiest adoption is using > 'def', despite the semantic conflict. ruby is so great at maintaining > context sensitive POLS over rigid uniformness it's a natural option > > x = def() 'people already would understand this' end So drop the `do`? Does this keyword work with curly braces? x = ->do 'presenting the amazing arrow syntax!!' end x = ->{ 'nicer without space after the arrow' } -- So I guess it would be... module Kernel define_method :call1, &def(x, &y) y[x] end end p call1(3) { |a| a + 1 } Vs: module Kernel define_method :call1, &->x, &y do y[x] end end p call1(3) { |a| a + 1 } Although everyone really uses: module Kernel define_method :call1 do |x, &y| y[x] end end p call1(3) { |a| a + 1 } -- Personally, could see this syntax most handy for stuff like assigning multiple events at once in Shoes: image.click ->{ image.hide }, ->{ image2.show } Not as fond of `def`: image.click def() { image.hide }, def() { image2.show } I didn't like the arrow syntax at all, but after using it, I get it. And with blocks being able to handle |x,*a,&b|, I don't use lambdas as much. _why