From: "ufuk (Ufuk Kayserilioglu) via ruby-core" Date: 2026-08-19T18:08:49+00:00 Subject: [ruby-core:126445] [Ruby Feature#22252] improve "defined with an un-shareable Proc in a different Ractor" error Issue #22252 has been updated by ufuk (Ufuk Kayserilioglu). Btw, if you make the block that you are passing to `define_method` shareable, then you can make that version work as well. The following version of the script will work properly: ```ruby # typed: true module A def hello puts "Hello" end define_method(:hi, &Ractor.shareable_proc do |*args, **kwargs| puts "hi" end) class_eval(<<~RUBY, __FILE__, __LINE__ + 1) def ahoy(*args, **kwargs) puts "ahoy" end RUBY end class B include A end b = B.new b.hello b.ahoy b.hi r = Ractor.new do b2 = B.new b2.hello b2.ahoy b2.hi end r.join ``` ---------------------------------------- Feature #22252: improve "defined with an un-shareable Proc in a different Ractor" error https://bugs.ruby-lang.org/issues/22252#change-118595 * Author: getajobmike (Mike Perham) * Status: Open ---------------------------------------- Hi, I'm trying to make my Ruby more compatible with Ractors. I'm seeing this error message but in an API with many abstractions, it can be difficult to determine the Proc in question. Would it be possible to include the source_location of the Proc to help improve debugging? ---Files-------------------------------- rtest.rb (350 Bytes) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/