Navindra Umanee <navindra / cs.mcgill.ca> writes: > Christian Neukirchen <chneukirchen / gmail.com> wrote: >> > Yeah, sorry for being unclear. I was referring to higher-order >> > functions i.e. Ruby blocks allow you to pass one anonymous lambda to a >> > higher-order function with convenient syntax... for more than that it >> > gets less convenient. >> >> This apparently got better with the anonymous blocks recently imported > > I'm not sure how that could be improved, since it's already doing what > it was designed to do. I think you can write foo {|x|...}, {|y|...} with recent CVS. >> in CVS, but I didn't try that yet. It's a restriction by design, >> though. > > Sure, that's why I called it syntactic sugar. It takes what Matz > thought would or should be a common case use of lambda/higher-order > functions in Ruby and makes it convenient. Exactly. Although Smalltalk doesnt suffer from "easy" (multiple) block syntax. It needs #call^Wdo, too. > I presume Guido is doing the same thing in his own way. He's making > it convenient to do things people might otherwise do with lambda. Of > course, he's going the other way and shunning lambda altogether... so > he's not looking for Lisp/Scheme fans but apparently catering to > another demographic. Afterall, there are plenty of successful > languages without lambda. For differing values of "successful". I think it is a well-known fact that lambdas (and closures) are a powerful way of abstraction. He *could* easily have them (and whom would they hurt?)... All in all, I can't think of any language that gets better because it loses lambdas. :-) >> >> You cannot do lambda{|x|x*2}(2), yes. >> > >> > Yup, and for calling functions objects in general. >> >> Yes. And actually this is proper OO. I couldn't justify mylambda() >> somehow. > > Proper OO? Um, well how can you justify: > > a = [1, 2] > a[1] > > but not: > > a = lambda{|x|x*2} > a(1) Ever tried a[1]? >> Fixing lambdas wouldn't have been an option, of course. :P > > ;-) > Cheers, > Navin. -- Christian Neukirchen <chneukirchen / gmail.com> http://chneukirchen.org