On Oct 25, 2006, at 10:32 PM, Tim Pease wrote:

> On 10/25/06, James Edward Gray II <james / grayproductions.net> wrote:
>>
>> I know people frown on the instance_eval() trick, but this seems to
>> be less of a problem.  You can just choose to use the variable when
>> you need it.
>>
>
> James, why do people frown upon instance_eval? I know you cannot speak
> for all people, but what are the reasons to avoid it?

I have literally seen code like this:

   must_save = self
   whatever do
     # use must_save in here, even though self changed...
   end

This is a sign of instance_eval() gone wrong, and Ara showed other  
issues.

Many take this as a sign that you should never instance_eval() a  
block like this, but I think that's going a bit far.  It's very handy  
in creating DSLs, for example.

James Edward Gray II