From: Trans Date: 2005-10-19T00:11:58+09:00 Subject: Re: Anonymous methods, blocks etc. (Cont. 'default block params') Austin Ziegler wrote: > On 10/18/05, Sean O'Halpin wrote: > > On 10/15/05, ES wrote: > >> 2. Blocks/Procs versus anonymous methods. Should these be actually > >> *different* > > Short answer - yes. An anonymous function would mean you're not > > carrying around a whole heap of baggage when no closure is required > > and gives you a clean scope to help prevent accidental aliasing > > errors. > > Except that Matz still plans on making anonymous functions have closure > capabilities. This is why, after Dave Thomas suggested: > > anon = def(x = 5) > # implementation of anon > end > > I then suggested: > > anon = lambda(x = 5) > # implementation of anon > end I agree that a *true* anonymous function is needed, but also think it would be nice if one could selectively "pull down" elements of closure somehow. Alos, there are other places in which non-closure can be helpful, such a Class.new{ }, so, please, we should not restrict this to functions. It has been suggestd before that using 'do...end' not provide closure while '{...}' would, but this has some issues, not the least of which is back(ward-compatability)-breaking. But perhaps if parenthesis were used on the 'do'? lambda do |x| # ... has closure end lambda do(x) # ... does not have closure end Just a thought. T.