On Thu, 26 Oct 2006, 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?
>
> My only guess is that it would be slower than calling the block
> directly -- block[self] -- as you showed in the code example.
>
> Thoughts?

the tk bindings work this way, and debugging can be frustrating:


   harp:~ > cat a.rb
   class C
     def a() :a end
     def c() :c end
     def m(&b) instance_eval &b end
   end
   def b() :b end

   p C.new.m{ mixed_scope = [a, b, c] }


   harp:~ > ruby a.rb
   [:a, :b, :c]


certainly has it's application though....

-a
-- 
my religion is very simple.  my religion is kindness. -- the dalai lama