Project

General

Profile

Actions

Bug #15596

closed

Kernel.warn without arguments should do the same as Kernel.warn(nil)

Added by kke (Kimmo Lehto) about 5 years ago. Updated almost 5 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18]
[ruby-core:91493]

Description

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
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0