Issue #14240 has been updated by nobu (Nobuyoshi Nakada).


jeremyevans0 (Jeremy Evans) wrote:
> nobu (Nobuyoshi Nakada) wrote:
> > jeremyevans0 (Jeremy Evans) wrote:
> > > > And non-default `$;` and `$,` are warned now.
> > > > Do you think these **names** should be warned too?
> > > 
> > > I don't feel strongly about it.  The `$;` and `$,` are currently run-time warnings based on the specific values passed when setting the values.  akr's previous comment indicated that the warnings of the five variables should be at compile time.
> > 
> > There are tons of that warnings, and it is not easy to suppress parser warning within the given file only.
> 
> Agreed.  I'm fine dropping these compile warnings if the run-time warnings are considered sufficient.

Another point is that compile warnings are for the names.
Use of aliases of them like English.rb will be still silent.

So, [this question](https://bugs.ruby-lang.org/issues/14240#note-13).
> Should we warn these four variable names, or their features?


----------------------------------------
Bug #14240: warn four special variables: $; $, $/ $\
https://bugs.ruby-lang.org/issues/14240#change-81009

* 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)
warn-5-gvars-v2.patch (5.44 KB)
warn-5-gvars-v3.patch (5.4 KB)


-- 
https://bugs.ruby-lang.org/