Actions
Feature #20715
open`Ractor.[]` and `Ractor.[]=` to access Ractor local storage
Description
Trivial proposal.
Now Ractor#[]/#[]=
is supported to access current ractor local storage. However, it doesn't allow to access local storage of other ractors.
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.
Updated by Eregon (Benoit Daloze) 5 days ago
+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).
Updated by byroot (Jean Boussier) 5 days ago
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.
Actions
Like0
Like0Like0