You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Ichoran said:
Unfortunately, the only way to change some of the awkward semantics of Java's BigDecimal (by carrying along a MathContext) is to wrap it rather than extending it, unless we override every method that returns a Java BigDecimal.
So inheritance doesn't really work--never really does, without a more advanced type system, when you need to return something of the same type as yourself.
@Ichoran said: @nilskp Yes, it is so bad. It matters which BigDecimal you're using, and it will be easy to get even more confused than you already are (e.g. use external library and not realize you need to rewrap), and it's a maintenance headache to catch everything (e.g. if Java ever adds a method to BigDecimal we have to notice and add it also and re-implement that function for earlier versions of Java so we're compatible with more than just the latest).
Since
java.math.BigDecimal
is not final, it would save an extra object instance ifscala.BigDecimal
extendedj.m.BD
instead of wrapping it.It would also make
s.BD
=>j.m.BD
conversion needless.Same applies to BigInteger/BigInt
The text was updated successfully, but these errors were encountered: