From: Mark Hubbart Date: 2005-02-18T02:55:53+09:00 Subject: Re: adding a dynamic method handler? (long post) On Thu, 17 Feb 2005 08:56:34 +0900, Sam Roberts wrote: > Wrote Robert Klemme , on Wed, Feb 16, 2005 at 06:19:50PM +0900: > > > > "Mark Hubbart" schrieb im Newsbeitrag > > news:de63abca0502152303763354f7@mail.gmail.com... > > > Hi, > > > > > > I've been using method_missing overly much in my code lately, and it's > > > prompted me to think a lot about it's limitations. > > > > > > > > > So, any thoughts? > > > > I'm wondering in which situation you need this. Although I understand the > > benefits of your approach I don't see the use case for this. > > I think I see what Mark was getting at. As I understand it, if I defined > a proxy object that used method_missing to forward all method calls to > an underlying object, I could call > > proxy.to_ary > > and if the underlying object was an Array, this would work. > > However, if I passed that into a library that was using duck-typing, and > that lib did > > proxy.responds_to? :to_ary > > the answer would be false. So, my Array proxy doesn't look as much like > an Array as it needs to. > > Do I understand correctly? Yes, that's the general rationale I had for this. Getting more of the reflection methods to work for dynamically defined methods. cheers, Mark