From: ko1@...
Date: 2020-12-18T21:03:13+00:00
Subject: [ruby-core:101522] [Ruby master Feature#17393]	`Ractor::Moved#inspect`

Issue #17393 has been updated by ko1 (Koichi Sasada).


I don't think providing `#inspect` is good idea because any methods should respond to the moved object.
Otherwise there is possibility to ignore the accessing moved objects.

I prefer to show the moved location in the error message.

```
x = []
Ractor.new{ receive }.send(x, move: true)
x.size

...:in `method_missing': can not send any methods to a moved object (moved at foo.rb:123) (Ractor::MovedError)
```


----------------------------------------
Feature #17393: `Ractor::Moved#inspect`
https://bugs.ruby-lang.org/issues/17393#change-89307

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
----------------------------------------
It could be helpful to define `Ractor::Moved#inspect` and output the source location of when the data was moved. If preferred, it could raise an error with this information:

```
x = []
Ractor.new{ receive }.send(x, move: true)
p x # => "Data was moved in `example.rb:4`"
# or
p x # => "Data was moved in `example.rb:4`" (Ractor::MovedError)
```

Also @zverok and myself were wondering if there was a technical reason to freeze `Ractor::Moved`? If not, is it only to "force" people to use refinements (which are allowed on frozen classes)? It's already known that it is in general a bad idea to modify builtin classes, so it's not clear to me that freezing that class is best.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>