3 ms·
> Ruby's anonymous function syntax was pretty novel Ruby: {|x| x+1} Smalltalk: [:x | x+1] What am I missing?
by llimllib 17y ago
> Ruby's anonymous function syntax was pretty novel
Ruby: {|x| x+1}
Smalltalk: [:x | x+1]
What am I missing?
- KirinDave 17y agoIt would help if your example was syntactically correct Ruby. (EDIT: I see you fixed it) And I meant novel in that it brought the notion into the dot-notation-happy world, where the majority of programmers lived and adapted it. Both Ruby an Smalltalk took the feature from a predecessor, as I understand it, and mentioning an also-ran like smalltalk slipped my mind. Does that weaken the point significantly? The feature is good and Python should finish integrating lambdas rather than sitting on their half-cocked nod to it. They cannot now Fo that for 2 years, maybe more.
- llimllib 17y agoI de-edited the end of my comment, because of weird time-related issues. > The feature is good and Python should finish integrating lambdas rather than sitting on their half-cocked nod to it. They cannot now for 2 years, maybe more. It's hard to "finish" a thing that hasn't started. Python has a whole aesthetic, and multi-line lambdas will likely never be a part of it. It's really quite a minor difference. I really think I'm not a zealot on the issue, and that I'm quite aware of the differences: http://billmill.org/multi_line_lambdas.html http://billmill.org/multi_line_lambdas.html ; what I'd like you to demonstrate is a place where giving a function a name is more than a minor inconvenience, and list comprehensions don't satisfy the need.