From: Chad Perrin Date: 2006-08-02T08:27:27+09:00 Subject: Re: [SPAM] Re: I thought this was the one that worked? On Wed, Aug 02, 2006 at 08:23:44AM +0900, Justin Collins wrote: > Chad Perrin wrote: > > > >Okay, so the fact that .each has its own scope differentiates it from a > >situation involving a mere conditional statement. I'll stipulate that > >for now (I'll probably agree more thoroughly later, when I've had a > >chance to consider the mechanics of scope for methods such as "each"). > >If such a relationship to a method is a necessary precondition of an > >idiomatic Ruby "block", complete with a thus-enclosing scope that ends > >while the block persists, I think we may finally have an almost-explicit > >case for *why* and *how* an idiomatic Ruby "block" is, necessarily, a > >"closure" -- assuming of course David's suggestion of a closed lexical > >scope as the necessary ingredient of a closure, rather than specifically > >the de-scoped variable within that lexical scope. > > > >That's some interesting, complex set of explanations for how a closure > >is achieved, but it's valid as far as I can see, and it does indeed seem > >to indicate that all Ruby blocks are closures. > > > >Thank you. > > > > > Does that mean this enormous thread is drawing to a close (pun possibly > intended)? :) I hope so. Every relationship needs closure. Ahem. It probably would have been much shorter if someone had been making these points about the relationship of methods to blocks and lexical scopes from the beginning -- instead, most of the discussion consisted of largely unexplained, and often overly complex, examples that didn't actually address the why/how question(s) necessary to illustrate the underlying principles. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] print substr("Just another Perl hacker", 0, -2);