#noDifference:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

#noDifference:

Ian Bartholomew-20
This is a follow-up to a post in c.l.s but as it's D6 specific I thought
I'd move it here.

D6 introduces a new Collection method in the "Set operations" category
named #noDifference:.  I originally suggested it c.l.s as a way of
comparing two Bags but have since realised that it doesn't work as I
thought.  For example

#(1 1 1 2) noDifference: #(1 2 2 2) answers true

I can't decide if ....

a) There's no problem - it's in a category named "Set operations" so it
should behave as if the arguments were Sets and ignore identical duplicates.

b) It's correct but needs an addition to the method comment to stress
the limitation.

c) It's correct but the method name could make it more explicit (and,
personally, I don't particularly like #noDifference: anyway - maybe
#hasSameContentsAs:).

d) It's a bug.  It seems to me that if it is treated as a Set operation
then both the following should give the same answer - they don't

#(1 1 1 2) noDifference: #(1 2 2 2)
#(1 1 1 2) noDifference: #(1 2 2)

Any thoughts?

Ian