Actions
Feature #17286
open`Ractor.new` should accept `move: true`
Status:
Open
Assignee:
-
Target version:
-
Description
Another surprise when writing my backport is that Ractor.new
does not accept move:
keyword argument.
Ractor.new(val, move: true) { |data| ... }
# equivalent to
Ractor.new { data = Ractor.receive; ... }.tap { |r| r.send(val, move: true) }
Updated by ko1 (Koichi Sasada) about 4 years ago
I'm also thinking about the same feature, and the problem is, maybe we should choose move or copy on each parameters:
Ractor.new io, # want to move
str # want to copy
do |io, str|
io.puts str
end
and I have no good idea about it.
Ractor.new Ractor.move(io), str do...
is one idea (wrap with special object for passing argument), but not sure it is the best....
Updated by marcandre (Marc-Andre Lafortune) about 4 years ago
I'd say let's start with a simple version and see what use-cases come up.
Seems already possible to mix and match anyways... Open the Ractor with one mode and yield
the other parameters using the other mode.
Actions
Like0
Like0Like0