[ruby-dev:50820] [Ruby master Bug#14240] warn four special variables: $; $, $/ $\
From:
merch-redmine@...
Date:
2019-07-26 23:19:11 UTC
List:
ruby-dev #50820
Issue #14240 has been updated by jeremyevans0 (Jeremy Evans).
File warn-5-gvars.patch added
Attached is a patch that adds a deprecation warning for the 5 global variables ($; $, $/ $\ $.), unless inside ruby `-e`. However, there is use of these variables inside Ruby that should be fixed if we plan to make this change. I've already seen the following issues:
```
/path/ruby/lib/erb.rb:907: warning: global variable $. is deprecated
../.././ext/ripper/tools/preproc.rb: warning: global variable $/ is deprecated
/path/ruby/lib/rubygems/specification.rb:14: warning: global variable $. is deprecated
```
It is likely there are more issues than just these three.
----------------------------------------
Bug #14240: warn four special variables: $; $, $/ $\
https://bugs.ruby-lang.org/issues/14240#change-80125
* Author: akr (Akira Tanaka)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
I think the four special variables for separators should be deprecated.
```
$/ input record separator (default argument for "gets")
$\ output record separator ("print" prints it at last)
$, default separator for Array#join and print
$; default separator for String#split
```
I feel many program doesn't work if they are set to non-default value.
Since they are global, not thread local,
we can not change these variables safely in a multi threaded program.
So, I think we should warn them (and delete them in future).
---Files--------------------------------
warn-5-gvars.patch (2.31 KB)
--
https://bugs.ruby-lang.org/