[#50354] 2.5.0で追加されたTime#atの引数について — Satoru Sakashita <sakasita@...>
坂下です。
8 messages
2017/12/16
[#50356] Re: 2.5.0で追加されたTime#atの引数について
— "Urabe, Shyouhei" <shyouhei@...>
2017/12/17
bXNlY+OBoOOBqOODn+ODquenkuOBi+ODnuOCpOOCr+ODreenkuOBi+WMuuWIpeOBjOOBpOOBi+OB
[#50357] Re: 2.5.0で追加されたTime#atの引数について
— Naotoshi Seo <sonots@...>
2017/12/18
5qiq44GL44KJ44GZ44G/44G+44Gb44KT44CC5LiA6Iis55qE44GrIG1pbGkgc2Vjb25kIOOBryBt
[#50358] Re: 2.5.0で追加されたTime#atの引数について
— "Urabe, Shyouhei" <shyouhei@...>
2017/12/18
MjAxN+W5tDEy5pyIMTjml6UgMTA6NDUgTmFvdG9zaGkgU2VvIDxzb25vdHNAZ21haWwuY29tPjoN
[#50394] [Ruby trunk Bug#14240] warn four special variables: $; $, $/ $\ — matz@...
Issue #14240 has been updated by matz (Yukihiro Matsumoto).
4 messages
2017/12/26
[#50396] Re: [Ruby trunk Bug#14240] warn four special variables: $; $, $/ $\
— Eric Wong <normalperson@...>
2017/12/26
Shouldn't English posts be on ruby-core instead of ruby-dev?
[ruby-dev:50401] [Ruby trunk Bug#14240] warn four special variables: $; $, $/ $\
From:
eregontp@...
Date:
2017-12-26 21:15:13 UTC
List:
ruby-dev #50401
Issue #14240 has been updated by Eregon (Benoit Daloze).
I agree.
These global variables can only be useful in tiny scripts,
and even then I believe none of them are idiomatic Ruby code.
All of these are shortcuts saving at best a couple characters,
but also threaten any usage of gets/print/split/join methods in larger programs.
Giving an argument gets/print/split/join is much clearer and safer.
I was already thinking along the same lines 6 years ago about $, in https://bugs.ruby-lang.org/issues/5977,
after being caught by a bug of some library setting $, and breaking the rest in very surprising ways iirc.
----------------------------------------
Bug #14240: warn four special variables: $; $, $/ $\
https://bugs.ruby-lang.org/issues/14240#change-69003
* 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/