From: Gary Wright Date: 2007-03-02T10:01:06+09:00 Subject: Re: Duck Typing Hash-Like Objects On Mar 1, 2007, at 7:38 PM, James Edward Gray II wrote: > You're still type checking, you're just doing it in a more fragile > way. If you want to type check, use the class, I say. Yet if I test for (Hash == mystery_obj) that would not allow someone to pass an RBTree object instead, which I think is a very reasonable thing to allow and works just fine if I only use #fetch. A minimum interface to an indexable collection might be: has_key?(key) fetch(key) store(key, val) In a quick look it seems like only Hash and RBTree implement those methods though. Gary Wright