Forum: Ruby-core Improve warning semantics

0256f4863b3a08d20a382766f842e63c?d=identicon&s=25 unknown (Guest)
on 2014-02-26 14:35
(Received via mailing list)
Issue #9423 has been updated by Franck Verrot.

I hope this is a related question: is one supposed to link the
$VERBOSE/$WARN levels to the "Logger" object's level? If so, how?

I am currently trying to figure out if they represent the same notion,
or if the $VERBOSE levels are more related to the interpreter's, and the
Logger ones let under each developer's responsibility.

Feature #9423: Improve warning semantics

* Author: Atlas Prime
* Status: Feedback
* Priority: Normal
* Assignee:
* Category: core
* Target version: current: 2.2.0
Two suggestions for future version of Ruby that wold make warning levels
more intuitive easier to work with.

First, rename $VERBOSE to $WARN for these reasons:

* `ruby` flags that set $VERBOSE are `-w` and `-W` (warnings levels).
* $VERBOSE controls output produced by `warn` method.
* $VERBOSE and FileUtils:Verbose are unrelated.
* $WARN is shorter ;-)

Second, it is confusing that `nil` and `false` mean different levels.
Instead of the current `nil` as level 0, `false` as level 1, and `true`
as level 2, it would be nice if `nil` and `false` both mean "off", and
then go from 0 on up to mean "on" of increasing degree. Just to clarify
my meaning (not a use case example):

    # nil, false mean no warning
    if $WARN
      case $WARN
      when 0
        # lesser level of warning
      when 1
        # greater level of warning
      when 2
        # can go higher if needed for rare use case

These are incompatible changes, but can be phased-in with support both
$WARN and $VERBOSE for intermediate period.
This topic is locked and can not be replied to.