* [ruby-core:101455] [Ruby master Feature#17393] `Ractor::Moved#inspect`
@ 2020-12-14 20:48 marcandre-ruby-core
2020-12-14 21:35 ` [ruby-core:101456] " marcandre-ruby-core
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: marcandre-ruby-core @ 2020-12-14 20:48 UTC (permalink / raw
To: ruby-core
Issue #17393 has been reported by marcandre (Marc-Andre Lafortune).
----------------------------------------
Feature #17393: `Ractor::Moved#inspect`
https://bugs.ruby-lang.org/issues/17393
* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:101456] [Ruby master Feature#17393] `Ractor::Moved#inspect`
2020-12-14 20:48 [ruby-core:101455] [Ruby master Feature#17393] `Ractor::Moved#inspect` marcandre-ruby-core
@ 2020-12-14 21:35 ` marcandre-ruby-core
2020-12-14 21:38 ` [ruby-core:101457] " marcandre-ruby-core
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: marcandre-ruby-core @ 2020-12-14 21:35 UTC (permalink / raw
To: ruby-core
Issue #17393 has been updated by marcandre (Marc-Andre Lafortune).
Maybe refining the message from `method_missing` is the best and simplest. (giving info that object was moved, and where).
I would also unfreeze the class unless there's a good reason not to.
----------------------------------------
Feature #17393: `Ractor::Moved#inspect`
https://bugs.ruby-lang.org/issues/17393#change-89226
* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:101457] [Ruby master Feature#17393] `Ractor::Moved#inspect`
2020-12-14 20:48 [ruby-core:101455] [Ruby master Feature#17393] `Ractor::Moved#inspect` marcandre-ruby-core
2020-12-14 21:35 ` [ruby-core:101456] " marcandre-ruby-core
@ 2020-12-14 21:38 ` marcandre-ruby-core
2020-12-16 20:55 ` [ruby-core:101478] " marcandre-ruby-core
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: marcandre-ruby-core @ 2020-12-14 21:38 UTC (permalink / raw
To: ruby-core
Issue #17393 has been updated by marcandre (Marc-Andre Lafortune).
Assignee changed from matz (Yukihiro Matsumoto) to ko1 (Koichi Sasada)
----------------------------------------
Feature #17393: `Ractor::Moved#inspect`
https://bugs.ruby-lang.org/issues/17393#change-89227
* 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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:101478] [Ruby master Feature#17393] `Ractor::Moved#inspect`
2020-12-14 20:48 [ruby-core:101455] [Ruby master Feature#17393] `Ractor::Moved#inspect` marcandre-ruby-core
2020-12-14 21:35 ` [ruby-core:101456] " marcandre-ruby-core
2020-12-14 21:38 ` [ruby-core:101457] " marcandre-ruby-core
@ 2020-12-16 20:55 ` marcandre-ruby-core
2020-12-18 21:03 ` [ruby-core:101522] " ko1
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: marcandre-ruby-core @ 2020-12-16 20:55 UTC (permalink / raw
To: ruby-core
Issue #17393 has been updated by marcandre (Marc-Andre Lafortune).
Discussed with ko1, who said he is afraid that unfreezing the class might create issues, as implementation is quite special. Possible implementation of `#inspect` for Ruby 3.1
Two things to keep in mind:
- usecase for unfreezing the class would be to implement `#inspect` in pure Ruby for 3.0, for example.
- it is possible to `refine` frozen classes, including `Ractor::Moved`, so freezing that class may not have the desired effect?
----------------------------------------
Feature #17393: `Ractor::Moved#inspect`
https://bugs.ruby-lang.org/issues/17393#change-89256
* 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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:101522] [Ruby master Feature#17393] `Ractor::Moved#inspect`
2020-12-14 20:48 [ruby-core:101455] [Ruby master Feature#17393] `Ractor::Moved#inspect` marcandre-ruby-core
` (2 preceding siblings ...)
2020-12-16 20:55 ` [ruby-core:101478] " marcandre-ruby-core
@ 2020-12-18 21:03 ` ko1
2020-12-18 21:11 ` [ruby-core:101525] " marcandre-ruby-core
2020-12-21 17:47 ` [ruby-core:101596] " ko1
5 siblings, 0 replies; 7+ messages in thread
From: ko1 @ 2020-12-18 21:03 UTC (permalink / raw
To: ruby-core
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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:101525] [Ruby master Feature#17393] `Ractor::Moved#inspect`
2020-12-14 20:48 [ruby-core:101455] [Ruby master Feature#17393] `Ractor::Moved#inspect` marcandre-ruby-core
` (3 preceding siblings ...)
2020-12-18 21:03 ` [ruby-core:101522] " ko1
@ 2020-12-18 21:11 ` marcandre-ruby-core
2020-12-21 17:47 ` [ruby-core:101596] " ko1
5 siblings, 0 replies; 7+ messages in thread
From: marcandre-ruby-core @ 2020-12-18 21:11 UTC (permalink / raw
To: ruby-core
Issue #17393 has been updated by marcandre (Marc-Andre Lafortune).
Yes, that looks good, that is what I was proposing in note 1 too 👍
----------------------------------------
Feature #17393: `Ractor::Moved#inspect`
https://bugs.ruby-lang.org/issues/17393#change-89310
* 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/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:101596] [Ruby master Feature#17393] `Ractor::Moved#inspect`
2020-12-14 20:48 [ruby-core:101455] [Ruby master Feature#17393] `Ractor::Moved#inspect` marcandre-ruby-core
` (4 preceding siblings ...)
2020-12-18 21:11 ` [ruby-core:101525] " marcandre-ruby-core
@ 2020-12-21 17:47 ` ko1
5 siblings, 0 replies; 7+ messages in thread
From: ko1 @ 2020-12-21 17:47 UTC (permalink / raw
To: ruby-core
Issue #17393 has been updated by ko1 (Koichi Sasada).
Try it on 3.1, not 3.0.
----------------------------------------
Feature #17393: `Ractor::Moved#inspect`
https://bugs.ruby-lang.org/issues/17393#change-89383
* 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/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-12-21 17:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-14 20:48 [ruby-core:101455] [Ruby master Feature#17393] `Ractor::Moved#inspect` marcandre-ruby-core
2020-12-14 21:35 ` [ruby-core:101456] " marcandre-ruby-core
2020-12-14 21:38 ` [ruby-core:101457] " marcandre-ruby-core
2020-12-16 20:55 ` [ruby-core:101478] " marcandre-ruby-core
2020-12-18 21:03 ` [ruby-core:101522] " ko1
2020-12-18 21:11 ` [ruby-core:101525] " marcandre-ruby-core
2020-12-21 17:47 ` [ruby-core:101596] " ko1
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).