From: merch-redmine@... Date: 2019-08-26T00:58:22+00:00 Subject: [ruby-dev:50837] [Ruby master Bug#14240] warn four special variables: $; $, $/ $\ Issue #14240 has been updated by jeremyevans0 (Jeremy Evans). File warn-5-gvars-v3.patch added 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. > > One problem with the implementation in my previous patch is that it warns at the wrong location. Switching from `rb_warn` to `rb_compile_warn` fixes that issue. > > It should be `rb_warn1` and `WARN_I(c)` for ripper. > And a typo `f.line_no` in template/encdb.h.tmpl. Thanks for the review. Attached is an updated patch that fixes these issues. ---------------------------------------- Bug #14240: warn four special variables: $; $, $/ $\ https://bugs.ruby-lang.org/issues/14240#change-81004 * 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/