[BUG] Set>>collect:

Bill Spight bspight at pacbell.net
Fri Feb 14 15:17:29 UTC 2003


Dear Richard,

> (1) The point of my message, as I hoped was clear, was that
>     Set>>collect: should *NOT* be fixed.
>     The message was not a [FIX] or an [ENH] but an *anti*[FIX],
>     a clear statement "Set>>collect: ISN'T BROKEN so DON'T 'fix' it."
> 

Your point about PluggableSet is well taken. I made an oversight.
However, something is broken, here.

Consider the fact that SortedCollection>>collect: yields an
OrderedCollection. That makes sense, because it is an extra burden on
collect: to sort the new collection. *And you can always sort the new
collection if you want to.*

By contrast, if sending collect: to IdentitySet produces a Set, it is
too late to go back and put in those elements that were rejected because
they were equal, but not identical. It is OK to go from IdentitySet to
Set, but not the other way.

So either you need to take a different approach, as Andrew Black is
doing, or do something with IdentitySet, Set, and PluggableSet. The
conservative way is to leave Set alone and override collect: in
IdentitySet to produce and IdentitySet. Or, more consistent with the
general default, change the method in Set to say, 'self species', and
override in PluggableSet to produce a Set.

But *something* needs fixing.

Best regards,

Bill



More information about the Squeak-dev mailing list