3 ms·
Can you give an example of the value this would provide that isn't provided by generics?
by horsawlarway 6y ago
Can you give an example of the value this would provide that isn't provided by generics?
- spopejoy 6y agoOne thing the example shows is the classic problem with OO's mechanism, namely binary functions. For a given class, something like `+` is impossible to implement elegantly, it has to bias one operand over the other -- after any syntactic sugar, it's always `arg1.op(arg2)`. Module functors resemble true ADTs more, in that they do not dispatch from a live instance of the datatype.