On 5/23/05, Mark Hubbart <discordantus / gmail.com> wrote: > Use of a "uniform" array would seem to preclude duck-typing. Even if > you use respond_to? instead of kind_of?, it wouldn't catch objects > that use method_missing to handle messages. For example: > > class Wrapper > def initialize(obj) > @obj = obj > end > def method_missing(*args, &block) > @obj.__send__ *args, &block > end > end > > If you use this class to wrap an object, code that relies entirely on > duck typing will still be able to use the object, even though it won't > respond_to? much of anything, and it won't be kind_of? the class you > want. Well, on this point, isn't it recommended that whenever you override method_missing you should also override respond_to? as well so that they agree? I thought this was in the docs but can't find it now in either ri method_missing or ri respond_to. Despite that, I know I've heard it mentioned various times on this list and in general it seems like a Good Idea. Jacob Fugal