From: dblack@... Date: 2006-11-05T22:20:01+09:00 Subject: Re: Accessing instance vars in a block? Hi -- On Sun, 5 Nov 2006, David Vallner wrote: > Hmm. This might have been brought up before, but blocks seem rather > underpowered with respects to manipulating them? A way to prevent their > binding scope from being clobbered by using them in an instance_eval > context would be nifty. But instance_eval takes a block; it's not a special context, but just how the method works. I don't think it would be good to try to figure out where the block came from and set up some mechanism that way. That goes against the grain of having first-class closures at all. I think one just has to hope people won't do the "stealth" instance_eval. If they do, you'd presumably know about it from the docs, and can avoid it. David -- David A. Black | dblack@wobblini.net Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org