Skip to content

Ractor.make_shareable checks proc's self#5232

Merged
ko1 merged 1 commit intoruby:masterfrom
ko1:fix_make_shareable_proc_with_unshareable_self
Dec 9, 2021
Merged

Ractor.make_shareable checks proc's self#5232
ko1 merged 1 commit intoruby:masterfrom
ko1:fix_make_shareable_proc_with_unshareable_self

Conversation

@ko1
Copy link
Copy Markdown
Contributor

@ko1 ko1 commented Dec 8, 2021

Ractor.make_shareable(proc_obj) raises an IsolationError
if the self of proc_obj is not a shareable object.

[Bug #18243]

Copy link
Copy Markdown
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the correct thing to do, and by far the easiest to understand semantics: can only make shareable by making deeply immutable, or special always-shared values (Module, Ractor).

@eregon
Copy link
Copy Markdown
Member

eregon commented Dec 8, 2021

Convenience for receiver.instance_eval { Proc.new { ... } } like Proc.new { ... }.bind(self) (or some option of make_shareable/define_method, etc) seems nice to add later, but that's much less urgent than fixing the bug.
It seems good to document the receiver.instance_eval { Proc.new { ... } } trick as that's not obvious but once understood makes a lot of sense.

@eregon eregon changed the title Ractor.make_shareable checks proc's sefl Ractor.make_shareable checks proc's self Dec 8, 2021
`Ractor.make_shareable(proc_obj)` raises an `IsolationError`
if the self of `proc_obj` is not a shareable object.

[Bug #18243]
@ko1 ko1 force-pushed the fix_make_shareable_proc_with_unshareable_self branch from d243350 to 2345042 Compare December 9, 2021 04:07
@ko1 ko1 merged commit cce3312 into ruby:master Dec 9, 2021
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