Get the latest tech news
The Numeric Tower Fiasco
OOP inheritance had one job to do.
The design violates the Liskov substitution principle: passing an Integer to a function that expects a Natural can produce incorrect results: We can easily change the implementation of naturals (e.g., use the more efficient binary representation) or add more numeric types (e.g., Rational s) without breaking other code. There is no way to extend an instantiable class and add a value component while preserving the equals contract, unless you’re willing to forgo the benefits of object-oriented abstraction.
Or read this on Hacker News