[ruby-core:120862] [Ruby master Feature#21109] Want to clarify how $/ is handled in Ractor

Issue #21109 has been reported by wanabe (_ wanabe). ---------------------------------------- Feature #21109: Want to clarify how $/ is handled in Ractor https://bugs.ruby-lang.org/issues/21109 * Author: wanabe (_ wanabe) * Status: Open ---------------------------------------- I am often in trouble because `$/` is inaccessible in Ractor. For example, `IO#readline` can't be called from non-main Ractor. ``` $ echo "foo"|ruby -e 'Ractor.new do p $stdin.readline end.take' -e:1: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues. #<Thread:0x00007efbf5ab4f58 run> terminated with exception (report_on_exception is true): <internal:io>:133:in 'IO#readline': can not access global variables $/ from non-main Ractors (Ractor::IsolationError) from -e:1:in 'block in <main>' <internal:ractor>:711:in 'Ractor#take': thrown by remote Ractor. (Ractor::RemoteError) from -e:1:in '<main>' <internal:io>:133:in 'IO#readline': can not access global variables $/ from non-main Ractors (Ractor::IsolationError) from -e:1:in 'block in <main>' ``` But when I use `Kernel.#readline` in Ractor, the behavior is as same as main Ractor. This behavior changes depending on whether accessing the global variable `$/` in ruby or the internal `rb_rs` in C. ``` $ echo "foo"|ruby -e '$/ = "o"; Ractor.new do p readline end.take' -e:1: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues. "fo" ``` I think it would be better if the behavior is unified and easy to understand. It would be ideal if it is possible to read and write from Ractor, but even if not, it would be nice if it is at least unified to reduce confusion. -- https://bugs.ruby-lang.org/
participants (1)
-
wanabe (_ wanabe)