From: MonkeeSage Date: 2007-11-25T01:50:00+09:00 Subject: Re: Hashes, Sets, and eql? On Nov 24, 8:34 am, Phrogz wrote: > Not always true: > > [...] Point taken. But still should not be relied on. > This discussion (using Hashes as hash or set keys, and the > requirements and possible implementations of of eql? for this to work > as sometimes desired) occurred in the last month or two on this list. Thanks, found it. [ http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/572e8d8b01a7d24e/c5f532d868afab05 ]. So it seems the only way to do it is something like... class Set def hash to_a.sort.hash end def eql?(o) return false unless o.is_a?(Set) @hash == o.instance_eval{@hash} end end ...which is basically what Aaron was already doing. Seems like there really should be a way to index keys on value rather than identity (even if it's not the default or requires a separate class like someone on the other thread mentioned that Smalltalk has). Regards, Jordan