New asFixnum, asBoolean, asString in Convert#8317
Merged
enebo merged 1 commit intojruby:9.5-devfrom Jul 22, 2024
Merged
Conversation
Note: asString overlaps with a method on IRubyObject so this may be changing
its name.
These are the first methods to replace Ruby.newFixnum sorts of methods.
Decoupling this is good for reasons:
1. Ruby is some mega method holder and it has long lost favor as an
object vs ThreadContext.
2. Passing ThreadContext to all JRuby methods (long term goal) means
we increasingly do not need Ruby in Ruby objects at all (very long
term goal).
3. Using static methods decouples our implementation from our API
This round did not completely eliminate all uses of the three methods but
it converted hundreds of them. The biggest disruption in this PR is that
a lot of @JRubyMethods which did not have ThreadContext now has them. This
meant keeping the old method around but marking it deprecated. The fact we
need to do this is a prime reason why the API initiave will pay off since
there will come a time when we do not need to worry about people consuming
our methods. The other side of this is our API will also be exposed properly
once we fully modularize (which will mean we long convert people to these
methods before we get to point where we cut off access to our other public
methods -- which is out impl).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: asString overlaps with a method on IRubyObject so this may be changing its name.
These are the first methods to replace Ruby.newFixnum sorts of methods. Decoupling this is good for reasons:
This round did not completely eliminate all uses of the three methods but it converted hundreds of them. The biggest disruption in this PR is that a lot of @JRubyMethods which did not have ThreadContext now has them. This meant keeping the old method around but marking it deprecated. The fact we need to do this is a prime reason why the API initiave will pay off since there will come a time when we do not need to worry about people consuming our methods. The other side of this is our API will also be exposed properly once we fully modularize (which will mean we long convert people to these methods before we get to point where we cut off access to our other public methods -- which is out impl).