-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
.to_d acts differently in jRuby 9.0.x than Ruby 2.2.x #3504
Comments
.to_d is actually defined in bigdecimal/util - http://apidock.com/ruby/String/to_d MRI
|
Ah, so jRuby includes the |
Hmmm. I wonder what is loading bigdecimal/util? It is something in our bootstrapping that needs it and we just happen to include it (and obviously MRI is not doing that). I guess if we knew what was loading it then perhaps we can try and do something else. However, in this case any foreign code you interact with might load this library (or over time you may end up inadvertently requiring it) so having any code which expects this to be undefined would end up being dicey... In my mind it is unclear this is really an issue we should address. [Actually having written all that I did a grep and I think we might have made some simpler ext mistake. I see in core/src/main/ruby/jruby/bigdecimal.rb we define BigMath in Ruby. This will force require bigdecimal/util (log and exp need .to_d). We must be requiring this file on boot. Do we really need to require this file for this iml? We could move requires into the log and exp methods but that will have a perf impact...hmm] |
I looked at this for a minute and realize that our kernel loads kernel/bigdecimal.rb for BigMath (which I think normally should only be included for bigdecimal/math but I am guessing isn't?). This file will unconditionally load bigdecimal/utils since it uses it for its impl. I think the real issue now is determining whether we are unconditionally loading bigdecimal/math when we shouldn't be or something needs it. |
... for better MRI compatibility (and less surprises) - closing jruby#3504
... for better MRI compatibility (and less surprises) - closing #3504
How to replicate
Open up IRB in jRuby 9.0.4.0:
Opening up IRB in Ruby 2.2.3:
System
nil.to_d
given a choice.The text was updated successfully, but these errors were encountered: