From: "wanabe (_ wanabe) via ruby-core" Date: 2025-02-02T13:18:08+00:00 Subject: [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. # terminated with exception (report_on_exception is true): :133:in 'IO#readline': can not access global variables $/ from non-main Ractors (Ractor::IsolationError) from -e:1:in 'block in
' :711:in 'Ractor#take': thrown by remote Ractor. (Ractor::RemoteError) from -e:1:in '
' :133:in 'IO#readline': can not access global variables $/ from non-main Ractors (Ractor::IsolationError) from -e:1:in 'block in
' ``` 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/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/