Reputation
Top tag
Next privilege 200 Rep.
See reduced ads
Badges
4
Newest
 Scholar
Impact
~675 people reached

  • 0 posts edited
  • 0 helpful flags
  • 4 votes cast
Nov
21
comment Are there programming languages that allow you to do set arithmetic on types?
Also, I ran into a case today where I have method that can take an A or a B, with two implementations that look exactly the same. In the method I'm calling a polymorphic method that can take an A or a B, so the implementations are the same, but since I have to take two distinct types I need two implementations. This would be easier if I could do myMethod(A | B aOrB).
Nov
21
comment Are there programming languages that allow you to do set arithmetic on types?
A pattern I've seen a lot is an interface that extends two other interfaces and doesn't add anything (i.e., CanWriteAndCompare extends Serializable, Comparable {}) and I was thinking of how to generalize this.