Hi -- On Thu, 20 Oct 2005, stevetuckner wrote: > I want to start a discussion about two things that Matz talked about at the > rubycon. Dave Thomas suggested that we could get Matz' anonymous function by > using "def" without a name. Others suggested that if def returned a method > object, then annotations could be applied to that object. So here goes my > suggestions. As they stand, they are not even parseable by Ruby, but lets > start talking about it anyway. > > Anonymous functions: > > x = def (a=1,b=2) { ... } > y = def(a,b=3) begin > ..... > end I don't think either of those is exactly what Dave suggested: x = def (a=1,b=2) ... end without the braces, and without 'begin', just like a method definition. I actually like the second iteration of the idea more: x = lambda (a=1,b=2) ... end using method-definition style for an anonymous function, but a different keyword. This keeps it more robust; there's a more "solid" indication that it's something other than a def. (Actually that was sort of the third iteration :-) The first was: -> (a=1,b=2) ... end which I posted here last week in an attempt to at least ameliorate the arrow thing. But having a real keyword plus the no-braces is definitely better.) David -- David A. Black dblack / wobblini.net