From: dblack@... Date: 2006-08-02T11:36:56+09:00 Subject: Re: I thought this was the one that worked? Hi -- On Wed, 2 Aug 2006, Chad Perrin wrote: > On Wed, Aug 02, 2006 at 10:01:11AM +0900, dblack@wobblini.net wrote: >> >> No, I meant that my comments about whether blocks were closures was >> hair-splitting. (Maybe the fact that I introduced the comments that >> way looked like I was actually summing up what came before, but the >> hair-splitting pronouncement ended with a colon :-) > > . . . so it was a complete non-sequitur? Mea culpa. I assumed that > comment had something to do with your response to me. In fact, the > impression I got was that you were talking about the hair-splitting that > occurs in the differentiation between "gets something from this scope" > and "could get something from this scope", but then decided to introduce > more hair-splitting about something related -- but not strictly. Sorry -- at this point my head is spinning. I really can't untangle the thread itself any further. > . . . which makes me wonder what you were actually saying about my > points, now. My main point was that you can see a closure in action in a negative sense, in a case where there are no local variables, by doing this: def x lambda { puts n } end n = 1 x.call # undefined local variable or method `n' You get an error because the "puts n" is being executed in the context in which the lambda was created. If it were being executed in the calling context, it would print 1. If you rule out calling the lambda a closure, then you have to explain this suspiciously closure-like behavior :-) Closures, one might say, close things out, as well as closing them in. David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <----- http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log http://www.manning.com/black => book, Ruby for Rails http://www.rubycentral.org => Ruby Central, Inc.