From: Gavin Sinclair Date: 2003-12-11T12:29:18+09:00 Subject: Re: Adjusting the Scope of Blocks [D. Black, ruthlessly snipped:] > > obj.instance_eval { stuff } > > where it's all visible and lexically scoped together, doesn't bug me at > all. It only starts feeling "trick"-like when the fact that the block > is going to be instance_eval'd in obj's self context isn't > manifest. I agree with everything you wrote, David. But taking a step back, I'm inclined to judge that when you pass a block to a method, you have some idea what the method will do to it. "Iterator" and "transactional" blocks are pretty obvious. "Event-handlers" are pretty cool, too, and it's easy to understand what they do (execute the block later). If a method is going to instance-eval or class-eval a block, then it's an unusual method (not in a common class of methods). Eval-ing is good for low-level infrastructure implementation more so than run-of-the-mill data processing. Methods that use ?_eval are likely to be "special", implementing unusual or tricky (but useful) concepts. Their documentation should therefore indicate what the user of the method can expect. Gavin