On Thu, 05 Aug 2004 21:32:55 +0000, Csaba Henk wrote:

> Set[Set[]].member? Set[]
>  => false
> And how does Array#uniq work? -- by what rule does it dispose elements
> if not by getting "true" by a "==" comparison with an other member of
> the array?

I think you raise a valid question.  Set is implemented using hashtables,
and compares hashes instead of objects.  A different hashtable gets a
different hash value, which is the reason for the strange(?) behaviour:

{}.hash == {}.hash
=> false
Set[].hash == Set[].hash
=> false
[].hash == [].hash
=> true

I have no idea for the reason why different hashes have different
hashvalues, while different arrays may get the same value (based on the
contents of the array).

KB