|
On 5 Feb 2008, at 07:47, Miles Bader wrote:
(1) The "super lightweight so I can stick it in a function call with an almost trivial expression and it won't look clumsy". [...] (2) As a simple way to add new control structures, by using smalltalk/ruby-like "blocks" to make function calls look sort of like control-structure.
[...]
So my vote is "yea" on a lightweight syntax like (1) -- I use that kindof thing all the time, and I'd love a more svelte way to express it --but "nay" on a "control-structure" lambda like (2), unless somebody hasa much better idea than those which have been proposed so far... [there's always metalua and the like for people that really want (2), after all]
The second case can be used for more than just control structures. Passing predicates to a collection method, for example. In Ruby:
mydata.sort { |a,b| a.upcase > b.upcase } mydata.collect { |x| x.shoesize > x.age/2 }In Lua you can pass functions to do that, but the syntax is not as compelling.
-jcw