Project

General

Profile

Actions

Bug #19368

open

Small issue with isolated procs and eval

Added by luke-gru (Luke Gruber) about 1 year ago. Updated about 1 year ago.

Status:
Assigned
Target version:
-
[ruby-core:111971]

Description

a = Object.new # non-shareable
prok = Ractor.current.instance_eval do
  Proc.new do
    eval('a')
  end
end
prok.call # this should work, we're in the main ractor and the proc is not isolated
Ractor.make_shareable(prok) # this doesn't currently work, but I think it should. It gives Ractor::IsolationError. See below for reasoning on why I think it should work.
# A flag seems to be set on the proc after it's run and accesses outers...

Because this work fine:

a = Object.new # non-shareable
prok = Ractor.current.instance_eval do
  Proc.new do
    eval('a')
  end
end
Ractor.make_shareable(prok) # this works, and it's okay because we get a different error when actually running the shareable proc inside a ractor that accesses outers through eval.
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0