In Scala, is it possible to "subtract" a type from a composed type like this one: "A with B with C" ?

-
-
Will Dotty change that?
-
I don't think it will change anything for intersection types, but it might for union types. The mechanism, if it gets implemented, would be to pattern match some cases against a union type, and the catchall's type would be the Union of the unmatched types from the original union.
- Show replies
New conversation -
-
-
A with B is the type which represents the set union of the properties of A and the properties of B. We can construct A with B with A, and (by set theory) it's identical to A with B. So including A in the intersection again is idempotent. (1/2)
-
Therefore, the inverse operation of "intersecting with A" is not well-defined. In general, if you "remove" A from A with B, you're left with... A with B. (2/2)
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.