Gavin King

Results 1136 comments of Gavin King

@phlopsi value equality is declared by the `Object` class, not by the `Identifiable` interface. `Identifiable` allows use of `===`.

> Sure, I can do `set(3..5).union(set(4..6))`, You can do `set(3..5) | set(4..6)`. > but is there any reason that `Range` couldn't satisfy `Set`? Yep, the reason is that `Range`s are...

> I suppose we *could* extend that to `List`s-of-same-element-type. (`List` is also a semigroup.) Oh, well, now, I remember, or course the problem here was that `Summable` is invariant and...

Interestingly, and subversively, nothing's stopping us from making `List` a `Multiplicable`, letting you write it using the `*` operator! (I'm not serious.)

> > I suppose we _could_ extend that to `List`s-of-same-element-type. (`List` is also a semigroup.) > > Oh, well, now, I remember, or course the problem here was that `Summable`...

Oh, I'm wrong again, the real problem is that `Sequential` is covariant, and `Summable` is invariant. So it can't be done at that level either.

So the only thing to do would be, I guess, to factor out `Unionable` and `Intersectable` interfaces and make `Map` and `Set` implement both (union and intersection for `Map` are...

@luolong oops, sorry, you're right, intersection can be defined for `Map`, but not union.

> I understand that it is convenient that ranges can be expected to have a predictable order of elements, but aren't they *also* effectively `Set`s? Well, sure, every `Iterable` is...

One possible reasonable thing to do would be to define `|` and `&` for the `Collection` interface, but have them *always produce `Set`s*. That is, simply pull the current `union()`...