From: Chad Perrin Date: 2006-08-02T05:03:00+09:00 Subject: Re: I thought this was the one that worked? On Wed, Aug 02, 2006 at 04:56:53AM +0900, Jacob Fugal wrote: > On 8/1/06, Chad Perrin wrote: > >Specifically, it sounds like what you're saying here would indicate that > >this is a closure: > > > > def foo > > bar = 0 > > lambda { puts bar += 1 } > > end > > > > baz = foo > > > >and this is a closure: > > > > def foo > > lambda { puts "Hellow world!" } > > end > > > > bar = foo > > Yes, this is exactly the point we've been trying to get across. Both > of these are closures. > > >but this is not a closure: > > > > foo = 0 > > > > foo.each do > > puts bar += 1 > > end > > This is where we get into what David Black described as hair > splitting. Lets move away from each, and to a set of more general > methods: Let's not. Hair splitting actually came up in reference to the distinction between the first two examples, and not in reference to the third. If you're calling the distinction for the third example "hair splitting", I'm just going to have to call you flat-out "wrong", unless this is a case of "the Ruby community uses a definition of 'closure' that is in direct contradiction of other definitions of 'closure'", which seems really odd to me since Ruby most definitely *is* capable of proper closures as defined elsewhere. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] "The first rule of magic is simple. Don't waste your time waving your hands and hopping when a rock or a club will do." - McCloctnick the Lucid