Hi --

On Tue, 27 Feb 2001, ts wrote:

> >>>>> "D" == David Alan Black <dblack / candle.superlink.net> writes:
> 
> D> # Define two new methods for Module, one eval'd, one not:
> 
>  This has nothing to do with #eval, try
> 
> D>   eval('class Module; def test(); end; end;');
>  
>      eval('class Module; private; def test(); end; end;');

Yes -- to quote my last post:

> I can get it symmetrical by putting "private;" in the eval -- but the thing
> is it claims it *is* private anyway....

:-)

But I still don't understand the asymmetrical behavior:.  

  eval('class Module; def test(); end; end;');
  if Module.private_methods.include? "test" then puts "test is private" end

   => test is private

  class Module
    def thing
    end
  end

  if Module.private_methods.include? "thing" then puts "thing is private" end

  =>  [no output]

If I put "private" in both, then they both seem to be the same.  If I take "private"
out symmetrically, then the eval'd one still claims to be private.

And Module claims to respond_to? the eval'd method, even though it also says it's
private.

So I'm still seeing an asymmetry I can't account for.


David

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