Generalizing number types seems harder than it should be

Well, yes, if you want to call it a limitation. :slight_smile: To me it looks more like a deliberate design decision in the first place. (But I may actually be wrong.)

Here’s a somewhat related previous discussion:

Java has an abstract class Number for the boxed primitive wrappers - I wouldn’t call this a great design. And I do recall that even back in the days when I was doing full OO Java, I’d prefer using Comparator (a poor man’s “type class”) over Comparable for various reasons. IOW, I don’t think having Numeric implemented as a type class must necessarily be a big surprise for anybody coming to Scala from the Java side - it wasn’t for me.

1 Like