From: "David A. Black" Date: 2003-12-10T02:55:08+09:00 Subject: Re: Adjusting the Scope of Blocks Hi -- On Wed, 10 Dec 2003, ts wrote: > >>>>> "D" == David A Black writes: > > D> I think that's what bothers me about this: it strikes me as a hybrid, > D> ad hoc way to achieve something that is neither really a closure nor > > Well, it's a closure no ? That's what I'm trying to figure out. def n; puts "n"; end x = 1 lam = lambda { n; puts x } I would expect that, as a closure, lam would always "remember" n and x from the context of its creation. Apparently it remembers x, but can be made to forget about n. That what seems very "magic" to me (and sort of unencapsulated). I understand that n is a method call and therefore is sensitive to 'self' in a way that local variables aren't; this is what I meant earlier about scope and self being different concepts. I guess I don't like the idea of swapping self *inside* the block (as opposed to the 'self' in whose context the block is called). > D> (in my opinion) really in keeping with the usual behavior and purpose > D> of #instance_eval. > > and you don't like class_eval ? Uh oh. I sense the beginning of the end :-) What don't I (appear to) like about it? David -- David A. Black dblack@wobblini.net