Richard Kilmer wrote: > I'm going to chime on this thread in two areas: > > 1) [...] > > 2) Sean: It seems like what you are looking for is to check a method for > 'semantic equivalence'...that is, you want to say that the [] and []= > methods on an object are semantically equivalent to the [] and []= methods > on Hash. Not that the object is in any way (from and inheritance > perspective) related to a Hash, nor does it actually get the behavior of a > Hash object's [] and []= methods, but when it comes to those two > methods...'quack like a Hash'. Does that sound right? If so, the question > becomes how to express this kind of semantic equivalence both in the > definition of the methods, and the checking with respond_to? > > -rich Rich, I've been watching this thread and I think you've hit the nail on the head. Sean seems to want semantic equivalence, but is using a syntax which is overloaded out of the box. Duck typing is based on syntax matching. It seems to me that the only way to get semantic equivalence without using type cues or explicit testing is to steer clear of overloaded operators and methods, so that syntax reflects semantics. This is what several others were suggesting when they talked about using hash's alternate method names in place [] and []=. --paul