From: dblack@... Date: 2007-06-09T20:10:03+09:00 Subject: Re: #respond_to? not working for dynamically generated metho Hi -- On Thu, 31 May 2007, James Edward Gray II wrote: > On May 30, 2007, at 3:31 PM, Robert Dober wrote: > >> This is very interesting, I just imagine that dynamic_finder does not >> give consistent results depending on events outside the Ruby >> program(*). Are you still happy with the semantics, instead of >> respond_to? giving false negatives it gives false positives now. > > Well, if it can't be made accurate, that's a different thing. First, we > would probably need to document that it can't be trusted in such a case. > >> You have created a dependency between method_missing and respond_to? I >> really feel bad about this. > > I guess that means that I made it so that respond_to?() needs to be updated > if method_missing() is? Yes, I guess that's right. > > David says that's bad. OK. I thought respond_to?() lying to me was bad. So > I guess we just chose to care about different things. I just raise an eyebrow at that much repeated/parallel code. > I guess each person needs to decide what is more important to them. I think it's just a matter of how you define respond_to? conceptually -- as a handle on the methods in the object's method lookup path, or as a registry of everything the object can do without raising an error. It's interesting in this connection that delegation adds the delegated methods to the respond_to? roster. I guess that summarizes the difference for me: a method that's delegated is known to be taken care of, whereas a method that's missing is missing (even if the potential error can be averted). David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)