From: "David A. Black" Date: 2005-08-29T22:40:22+09:00 Subject: Re: Method behaves differently when called using #send Hi -- On Mon, 29 Aug 2005, Malte Milatz wrote: > David A. Black wrote: >> irb(main):008:0> class C; def x; 1; end; private :x; end => C >> irb(main):009:0> class C; def method_missing(m); p m; end; end => nil >> irb(main):010:0> C.new.x >> :x >> should give a "private method 'x'" error. >> >> Then again, that's actually a NoMethodError.... Maybe it should be a >> UnavailableMethodError or something. > > In my opinion, an object shouldn't tell others about its internals unless > explicitly asked. So a NoMethodError is OK IMHO. Consequently, I agree > with the current behavior calling method_missing here. But look at the error message: irb(main):003:0> 1.puts NoMethodError: private method `puts' called for 1:Fixnum It's contradictory: "no method", but "private method called". "No method" really doesn't describe the situation. Perhaps no *response*, but not no method. David -- David A. Black dblack@wobblini.net