Hello --

On Fri, 31 Aug 2001, ts wrote:

>
> >>>>> "D" == David Alan Black <dblack / candle.superlink.net> writes:
>
>  Well, you don't give the same example

I wasn't trying to :-)

> D>   class Foo; end
> D>   Foo.class_eval "def bar; puts 'bar'; end"
> D>   Foo.new.bar  # => bar
>
>   here you've used class_eval
>
> D>   class Foo; end
> D>   Foo.send(:eval, "def thing; end")
> D>   [].thing
> D>   -:3: private method `thing' called for []:Array (NoMethodError)
>
>  here you've used eval


Right.  In the sentence just before these examples, I said:

> D> For one thing, keep in mind that Class.send(:eval, str) is not the
> D> same as Class.class_eval str.

I thought that perhaps Paul had been thinking of these two things as
equivalent, so I wanted to demonstrate that they weren't.  So I wrote
one example of each.


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav