----- Original Message ----- 
From: Dave Thomas <Dave / PragmaticProgrammer.com>
To: ruby-talk ML <ruby-talk / ruby-lang.org>; <ruby-talk / netlab.co.jp>
Sent: Friday, July 13, 2001 8:57 AM
Subject: [ruby-talk:17794] Re: What is Array#- ?


[snip]

> So my vote would be to create a new Set class (possibly delegating to
> Hash, but that's an implementation detail), and to add the new set
> methods to it. I'd then vote to remove the magical properties from
> Array#-, and I'd suggest changing Array#| to operate more like 'or':
> elements in common between the operands aren't duplicated:

I agree... but there still might be decisions to be made.

For example, when you iterate over a set (at least, the way I was taught
in discrete math), you don't get any fixed ordering. Two possibilities 
might be just to document this and let the user hang himself; or we might
actually randomize the order so that it was actually different each time.

Another question is: Might there be times when it was difficult to tell
whether an object being added was a duplicate? What kind of equality
test do we use, considering that a set might contain completely arbitrary
objects?

Hal