Skip to content
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

Disable usage of Ractor.make_shareable on Ruby 3.0 as it's broken on Ruby 3.0.2. #56

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

ioquatix
Copy link
Member

@ioquatix ioquatix commented Mar 20, 2024

The following test code demonstrates the problem:

#!/usr/bin/env ruby

class Object
	if const_defined?(:Ractor)
		def self.define_immutable_method(name, &block)
			block = Ractor.make_shareable(block)
			self.define_method(name, &block)
		end
	else
		def self.define_immutable_method(name, &block)
			define_method(name, &block)
		end
	end
	
	def self.[] **levels
		klass = Class.new(self)
		
		klass.instance_exec do
			levels.each do |name, level|
				define_immutable_method(name) do
					puts severity: name, level: level
				end
			end
		end
		
		return klass
	end
end

Filter = Object[info: 0, debug: 2]

filter = Filter.new

filter.info
filter.debug

Types of Changes

  • Bug fix.

Contribution

@ioquatix ioquatix force-pushed the disable-ractors-3.0 branch from 7f5a1a1 to d1aaba1 Compare March 20, 2024 07:50
@ioquatix ioquatix merged commit 32150d0 into main Mar 20, 2024
40 of 44 checks passed
@ioquatix ioquatix deleted the disable-ractors-3.0 branch March 20, 2024 07:52
@olleolleolle
Copy link
Contributor

Good context in the commit message!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants