[ruby-core:119050] [Ruby master Feature#20715] `Ractor.[]` and `Ractor.[]=` to access Ractor local storage

Issue #20715 has been reported by ko1 (Koichi Sasada). ---------------------------------------- Feature #20715: `Ractor.[]` and `Ractor.[]=` to access Ractor local storage https://bugs.ruby-lang.org/issues/20715 * Author: ko1 (Koichi Sasada) * Status: Open * Assignee: ko1 (Koichi Sasada) ---------------------------------------- Trivial proposal. Now `Ractor#[]/#[]=` is supported to access current ractor local storage. However, it doesn't allow to access local storage of other ractors. ```ruby Ractor.current[:foo] = 1 Ractor.new{ p Ractor.main[:foo] #=> nil }.take ``` So providing `Ractor.[]/[]=` is more reasonable. Further more, we don't need to use `Ractor#current` and it is slightly faster. -- https://bugs.ruby-lang.org/

Issue #20715 has been updated by Eregon (Benoit Daloze). +1, makes perfect sense (IMO it would be nice to do the same for Fiber and Thread as well but out of scope of this issue). ---------------------------------------- Feature #20715: `Ractor.[]` and `Ractor.[]=` to access Ractor local storage https://bugs.ruby-lang.org/issues/20715#change-109674 * Author: ko1 (Koichi Sasada) * Status: Open * Assignee: ko1 (Koichi Sasada) ---------------------------------------- Trivial proposal. Now `Ractor#[]/#[]=` is supported to access current ractor local storage. However, it doesn't allow to access local storage of other ractors. ```ruby Ractor.current[:foo] = 1 Ractor.new{ p Ractor.main[:foo] #=> nil }.take ``` So providing `Ractor.[]/[]=` is more reasonable. Further more, we don't need to use `Ractor#current` and it is slightly faster. -- https://bugs.ruby-lang.org/

Issue #20715 has been updated by byroot (Jean Boussier).
it would be nice to do the same for Fiber and Thread as well
Would also be the occasion for `Thread[]` to be actual thread local instead of fiber local. ---------------------------------------- Feature #20715: `Ractor.[]` and `Ractor.[]=` to access Ractor local storage https://bugs.ruby-lang.org/issues/20715#change-109678 * Author: ko1 (Koichi Sasada) * Status: Open * Assignee: ko1 (Koichi Sasada) ---------------------------------------- Trivial proposal. Now `Ractor#[]/#[]=` is supported to access current ractor local storage. However, it doesn't allow to access local storage of other ractors. ```ruby Ractor.current[:foo] = 1 Ractor.new{ p Ractor.main[:foo] #=> nil }.take ``` So providing `Ractor.[]/[]=` is more reasonable. Further more, we don't need to use `Ractor#current` and it is slightly faster. -- https://bugs.ruby-lang.org/

Issue #20715 has been updated by nobu (Nobuyoshi Nakada). I'd expect that accessing other Ractors' local storages will raise an exception. ---------------------------------------- Feature #20715: `Ractor.[]` and `Ractor.[]=` to access Ractor local storage https://bugs.ruby-lang.org/issues/20715#change-110472 * Author: ko1 (Koichi Sasada) * Status: Assigned * Assignee: ko1 (Koichi Sasada) ---------------------------------------- Trivial proposal. Now `Ractor#[]/#[]=` is supported to access current ractor local storage. However, it doesn't allow to access local storage of other ractors. ```ruby Ractor.current[:foo] = 1 Ractor.new{ p Ractor.main[:foo] #=> nil }.take ``` So providing `Ractor.[]/[]=` is more reasonable. Further more, we don't need to use `Ractor#current` and it is slightly faster. -- https://bugs.ruby-lang.org/
participants (4)
-
byroot (Jean Boussier)
-
Eregon (Benoit Daloze)
-
ko1 (Koichi Sasada)
-
nobu (Nobuyoshi Nakada)