From: shevegen@... Date: 2017-12-26T11:08:07+00:00 Subject: [ruby-dev:50398] [Ruby trunk Bug#14240] warn four special variables: $; $, $/ $\ Issue #14240 has been updated by shevegen (Robert A. Heiler). By the way, the awk-inspired names such as $NR, $ORS, $RS, also do not tell me anything. :-) In fairness, I also have to admit that the english names also do not always tell me that much more. Depends on the name. http://ruby-doc.org/stdlib/libdoc/English/rdoc/English.html $\ = ' -- ' "waterbuffalo" =~ /buff/ print $', $$, "\n" versus require "English" $OUTPUT_FIELD_SEPARATOR = ' -- ' "waterbuffalo" =~ /buff/ print $POSTMATCH, $PID, "\n" The second variant is a tiny bit more readable to me, but I also can not tell you what $OUTPUT_FIELD_SEPARATOR really means, without having to look at the docu. :) And $POSTMATCH hmm... I can try to make a guess, but I am not sure. I'd have to look at the docu. :D Only $PID I can infer at once... to mean the PID of a process. I like that name. Please tell me that it does not mean anything else than PID ... :D My brain takes more time for the first code variant and in general, I try to write only very simply code in ruby (which is also why I am absolutely bad at golfing and one-liners, but I understand if people want to be able to be super-succinct ... I remember the xmas tree in code golfing, that's more like art than code though). What actually makes me not use "English" there is the require line - see also headius' suggestion elsewhere. I liked the recent change in regards to pp for similar reason, less to type. :) (Although I was using pp a LOT nonetheless, it is too useful to me to not make use of it. It just is less typing for me now past 2.5.x) Anyway, I digress so I better stop now. ---------------------------------------- Bug #14240: warn four special variables: $; $, $/ $\ https://bugs.ruby-lang.org/issues/14240#change-68993 * 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). -- https://bugs.ruby-lang.org/