Hi --

On Wed, 14 Sep 2005, Hugh Sasse wrote:

> This being a Set I don't really need the call to include? now, but
> it's there (from when I was using a hash for this).
>
> I find two things that seem odd to me:
>
> 1. eql? is never getting called, despite include?.
>
> 2. I end up with duplicate students.
>
> Sets *can't* hold duplicates, and include depends on eql? for Sets.

Are you sure about that latter point?  In set.rb:

   def include?(o)
     @hash.include?(o)
   end

and in hash.c:

     if (st_lookup(RHASH(hash)->tbl, key, 0)) {
         return Qtrue;
     ... }

I haven't followed the trail beyond that... but I think any two
student objects will count as different hash keys, even if they have
similar string data.


David

-- 
David A. Black
dblack / wobblini.net