From: "Bartosz Dziewoński" Date: 2011-10-06T01:41:32+09:00 Subject: Re: Local vs method vs instance (was: Operator Overloading) 2011/10/4 Adam Prescott : > 2011/10/4 Bartosz Dziewoński > >> >> 5. Stabby Lambda variables >> > >> > What do you mean by this? >> >> Regular lambda: a = lambda{|x,y| x+y} - it cant have, for example, >> default value for arguments. >> > > ? > >>> l = lambda { |x, y=2| [x,y] } > => # > >>> l.call(1) > => [1, 2] > >>> RUBY_VERSION > => "1.9.2" > > As far as I know, ->{} is absolutely no different from lambda {}. > Huh, that's true, I didn't realize - it didn't work on 1.8.x. I though it wouldn't work for example due to ambiguity with the | method/operator: a = lambda{|x, y=x|2| x+y} Interestingly, it works. (But probably not the way you would expect.) -- Matma Rex