[ruby-core:124821] [Ruby Feature#17513] Methods of shareable objects and UnboundMethods should be shareable
Issue #17513 has been updated by trinistr (Alexander Bulancov). A `def`-ed method of a shareable object may depend on unshareable state. Even worse, shareability of state may dynamically change: ```ruby module Checker CHECK = [] def check? CHECK.include?(self) end end class A; include Checker; end obj = A.new.freeze Ractor.shareable?(obj) # => true Ractor.new(obj) { |o| p o.check? } # Ractor::IsolationError Checker::CHECK.freeze Ractor.new(A.new.freeze) { |o| p o.check? } # false Checker::CHECK = [] # And here we go again ``` ---------------------------------------- Feature #17513: Methods of shareable objects and UnboundMethods should be shareable https://bugs.ruby-lang.org/issues/17513#change-116442 * Author: marcandre (Marc-Andre Lafortune) * Status: Assigned * Assignee: ko1 (Koichi Sasada) ---------------------------------------- ```ruby class Foo def foo end end f = Foo.new.freeze Ractor.shareable?(f) # => true Ractor.make_shareable(f.method(:foo).to_proc) # => Proc, ok Ractor.make_shareable(f.method(:foo)) # => Ractor::Error, expected Method Ractor.make_shareable(Foo.instance_method(:foo)) # => Ractor::Error, expected UnboundMethod ``` -- https://bugs.ruby-lang.org/
participants (1)
-
trinistr (Alexander Bulancov)