From: shevegen@... Date: 2019-02-08T14:42:07+00:00 Subject: [ruby-core:91494] [Ruby trunk Bug#15596] Kernel.warn without arguments should do the same as Kernel.warn(nil) Issue #15596 has been updated by shevegen (Robert A. Heiler). This is indeed a (to me) somewhat surprising behaviour; not that I guess many have encountered it. Current documentation is at: https://ruby-doc.org/core-2.6.1/Kernel.html#method-i-warn If the behaviour is not a bug then I think it should be mentioned in the documentation at the least briefly to explain why it behaves that way. If the behaviour is a bug, though, then I think I concur with Kimmo, but I really do not know any specifics. It did seem strange though, since I was not able to determine as to why warn nil would be treated differently than warn without arguments. ---------------------------------------- Bug #15596: Kernel.warn without arguments should do the same as Kernel.warn(nil) https://bugs.ruby-lang.org/issues/15596#change-76754 * Author: kke (Kimmo Lehto) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- Kernel.warn without arguments does not print an empty line to $stderr. This is inconsistent with `Kernel.puts` and it feels weird, because it does not act like a regular Ruby method would (if it was written in Ruby instead of C, it would probably be defined like `def warn(msg = nil)` and calling it with or without nil as argument would make no difference) ### Expected behavior: ``` irb(main):001:0> warn nil => nil irb(main):002:0> warn => nil ``` ### Actual behavior: ``` irb(main):001:0> warn nil => nil irb(main):002:0> warn => nil ``` -- https://bugs.ruby-lang.org/ Unsubscribe: