From: ko1@... Date: 2020-12-18T21:10:42+00:00 Subject: [ruby-core:101524] [Ruby master Feature#17404] Ractor `move:` API to allow shareability check Issue #17404 has been updated by ko1 (Koichi Sasada). marcandre (Marc-Andre Lafortune) wrote in #note-2: > ko1 (Koichi Sasada) wrote in #note-1: > > `#send_ref(message)` and raise an error if message is not a sharable? > > There would be an easy way to deep-copy or deep-move an object, right? If you mean that the default should be `pass: :share`, then that seems fine by me. not sure what you mean. I mean: ```ruby def send_ref(obj) raise unless Ractor.shareable?(obj) send(obj) end ``` > We have to consider impact for passing arguments to `Ractor.new(...)`. Right now these are copied; would it also raise if the arguments are not shareable? Would you add `pass:` option there too (see #17286)? I guess it is different topic. ---------------------------------------- Feature #17404: Ractor `move:` API to allow shareability check https://bugs.ruby-lang.org/issues/17404#change-89309 * Author: marcandre (Marc-Andre Lafortune) * Status: Open * Priority: Normal * Assignee: ko1 (Koichi Sasada) ---------------------------------------- I'd like to `ractor.send(message)` and express that `message` should be shareable. Currently I'm given two choices: `move: true` and `move: false` / nothing, neither of which have an effect if my `message` is shareable, and neither of which will tell me in case there's a bug in my program and `message` is not shareable. Could we consider a slightly different API (for 3.0 or 3.1)? ```ruby ractor.send(message, pass: :copy) # => like current `move: false` ractor.send(message, pass: :move) # => like current `move: true` ractor.send(message, pass: :share) # => raise in case message is not shareable ractor.send(message) # => same as `pass: :copy` ``` -- https://bugs.ruby-lang.org/ Unsubscribe: