-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BigDecimal should NEVER throw exceptions!!! #95
Comments
Updated bundler and now I have to go inspect every BigDecimal in my codebase for BREAKING changes!!! Not ok. |
No, it should. |
disagree. Math functions should not raise exceptions. If Integer raises exceptions, that should be fixed also. |
The ability to raise is very useful when dealing with external input. The old behaviour is coercing to zero from The behaviour you need is still there, just find & replace. |
The ability to raise is also insanely annoying when your code continually breaks because every minor library call didn't like your unformatted input, and caused a halt. It's a bug not a feature. |
@Tectract If you want to discuss them, you should go to https://bugs.ruby-lang.org/. By the way,
How do you fix this?
|
If you don't want to use the latest bigdecimal, you can specify the old version in your Gemfile. Thanks. |
Correct.
What if a result is calculated wrong with an invalid input? How are you going to know that is caused by such input? Then how you'll deal with the wrong result, when the input was lost at the timing of notice of the error? |
Should be re-opened. BigDecimal should never throw errors.
NaN should be output in such a case.
Referring to an old version because a BUG was introduced in the new version is not a solution. |
NaN or infinity. Simple. |
I request this issue should be re-opened, until this discussion is finalized: |
We are not going to re-open this. Raising an exception is perfectly reasonable in Ruby. Every language has a different paradigm and not respecting the language's design like above is absurd. See how different Golang is from Ruby. It simply doesn't make sense to add the exception me mechanism to Golang, or to remove it from Ruby. |
BigDecimal should not throw errors. Ever. You guys need to wrap the code in a begin...rescue with a return 0 for all "error" cases. Anything that's not a valid number is 0 or null or NaN or whatever, but this little math function should NOT be halting my code by throwing errors back upstream.
'invalid value for BigDecimal()'
NO! What the hell!? Whose idea was it for a math function to kick up exceptions?
The text was updated successfully, but these errors were encountered: