Project

General

Profile

Actions

Feature #2709

closed

$VERBOSE, $DEBUG and Kernel#sprintf

Added by paddor (Patrik Wenger) over 12 years ago. Updated almost 5 years ago.

Status:
Rejected
Priority:
Normal
Target version:
[ruby-core:28029]

Description

=begin
Kernel#sprintf is very useful. I think the power lies within the ignorance of too many arguments. So one is free to decide which arguments he uses and which one he doesn't. This applies to a Ruby runtime where $VERBOSE and $DEBUG are false.

Following the POLS (Principle of the least surprise), one would assume that changing the variables $VERBOSE and $DEBUG wouldn't change the behavior of Kernel#sprintf. But they do.

$VERBOSE causes warnings when there are too many arguments.
$DEBUG causes an ArgumentError when there are too many arguments. This isn't useful at all.

I like the effect of $DEBUG according to threads, to raise uncaught exceptions from the thread.
But in the case of Kernel#sprintf, it's just not useful. This behavior prohibits some power of Ruby.

My suggestion:
Remove the special behavior of $VERBOSE and $DEBUG in Kernel#sprintf.

Thank you very much.
=end


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #5763: sprintf not throwing error for wrong number of argumentsClosed12/15/2011Actions
Actions

Also available in: Atom PDF