From: Sean O'Halpin Date: 2005-10-19T00:35:21+09:00 Subject: Re: Anonymous methods, blocks etc. (Cont. 'default block params') On 10/18/05, Trans wrote: > I agree that a *true* anonymous function is needed, I'm surprised more people don't seem to think real anonymous functions would be useful. I'm pretty sure they'd be applicable in the majority of cases where we use blocks now, especially with map, inject, select, grep, etc. They would surely be more efficient (no need to set up binding, no lookup outside current scope, lower memory usage). > but also think it > would be nice if one could selectively "pull down" elements of closure > somehow. What do you mean by 'elements of closure'? > lambda do |x| > # ... has closure > end > > lambda do(x) > # ... does not have closure > end I quite like that. While we're at it, how about lambda {|x| .. } for closure and lambda [|x| ... ] for anonymous functions (on analogy with hashes vs arrays, i.e. more complex vs simpler). However, the absence of this as an option makes me think it has already been suggested and shot down. Regards, Sean