146 reputation
4
bio website haldean.org
location San Francisco, CA
age 24
visits member for 2 years, 6 months
seen Oct 14 at 0:16

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.