Make Ractor-compatible#344
Open
jhawthorn wants to merge 11 commits into
Open
Conversation
Previously this was using class variables, however this module isn't included anywhere, so we might as well just use plain ivars
The @@available_functions class-variable wasn't frozen (to allow runtime methods to be added). I should be as fast to check for method_defined?(name, false), though this requires Ruby 2.6
Needed for method_defined?(x, false)
This fixes a FrozenError on Ruby 2.6/2.7. On Ruby 3.0+ interpolated strings are always unfrozen
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.
For the most part this just involved freezing Strings or other constants. I tried to aim for the best final state rather than workarounds, so let me know if any changes are desired/anything is too aggressive ❤️. Where possible I changed to
frozen_string_literal: trueinstead of simply freezing the required constants.Two more significant changes are:
FunctionsClassto usemethod_defined?(x, false)instead of maintaining a mutable hash. This required bumping to Ruby 2.6REXML::Securityto use ivars instead of cvars. This module wasn't included anywhere internally so it should work the same. (Ruby 4.1+ will allow cvars to be read from Ractors so this change was only necessary for earlier/current versions, but I think it's faster and better anyways)