-
Notifications
You must be signed in to change notification settings - Fork 85
Deprecate BigDecimal.new #86
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
Conversation
|
Do you have the ticket with the reasoning to remove this method? Is it to match |
|
The reason is to match core numeric classes like Integer, Float, and Rational. I've created the issue #89 to remove BigDecimal.new at Ruby 2.6. |
|
Thanks! That make a lot of sense |
|
This may be the case, but it causes a lot of downstream errors and is a breaking change done on a minor version. What would be the harm in leaving this syntax and encouraging the new syntax instead? I feel we should be very careful in deprecations like this as the downstream impact is substantial. It creates inconsistencies in Ruby and causes a lot of confusion for newer engineers. Consider that we have:
...and several others. Across Ruby this is very inconsistent, and is very confusing to me. |
|
BigDecimal is a subclass of Numeric, and core Numeric subclasses such as Integer don’t have The Kernel methods you listed up are provided for conversion. |
|
I do not argue with the consistency, I argue with the deprecation in a minor version causing several downstream repositories to break. The cost of leaving |
|
You can select version 1.3.5 if you need |
| static VALUE | ||
| BigDecimal_s_new(int argc, VALUE *argv, VALUE self) | ||
| { | ||
| rb_warning("BigDecimal.new is deprecated"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a note, maybe this should have been rb_warn, as rb_warning only warns with $VERBOSE=true / ruby -w, not the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bigdecimal 1.4.x always warns in BigDecimal.new.
See https://github.com/ruby/bigdecimal/blob/v1.4.x/lib/bigdecimal.rb#L10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but in e.g. MRI 2.5.3, bigdecimal 1.3.4 is default and so:
$ ruby -rbigdecimal -e 'p BigDecimal.new "2"'
0.2e1
does not warn (without -v/-w).
To remove
BigDecimal.newfrom Ruby 2.6, this should be deprecated during Ruby 2.5 period.