Fwd: Add intersections and unions to Set

Jason Orendorff jason.orendorff at gmail.com
Tue Mar 5 08:53:44 PST 2013


On Tue, Mar 5, 2013 at 8:15 AM, David Bruant <bruant.d at gmail.com> wrote:

> I agree on the need but forsee problems with parametrized equivalence
> operator [1][2] like "which comparator should be used for the union of 2
> sets with different comparators?"
>

I vote TypeError. If I really do intend to mix two incompatible Sets, I can
go ahead and write it longhand, which is what, 3 lines? 2 with
set.addAll(iterable).

The need for set intersection/union/minus/etc. feels more important than
> the need to parametrized the comparator.
>

Not sure why this distinction matters, but I feel the opposite. You can
very easily and naturally write intersection/union/minus/etc. based on the
primitives already in the spec. Not so with custom equivalence! And keys
that are pairs or small records are a very common need.

Intersection et al are easier but much less important.

-j
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130305/78b9a45f/attachment.html>


More information about the es-discuss mailing list