From: Andrew Johnson Date: 2006-03-29T07:43:42+09:00 Subject: Re: is -w really useful? On Wed, 29 Mar 2006 07:17:10 +0900, Wybo Dekker wrote: > > Well, you can already say: $VERBOSE = true or $VERBOSE = false. > Isn't that the same? Actually, $VERBOSE can take on three semantic values: nil, false, true. Further, behaviour can differ slightly if -W0, -W1, -W2 (ie, nil, false, true (and -w == -W2) are set from the command line as opposed to setting $VERBOSE in the script (parse-time vs runtime). This means that doing something akin to: module Kernel def no_warn begin verbose = $VERBOSE $VERBOSE = nil yield ensure $VERBOSE = verbose end end end no_warn do puts (0..5) end doesn't quench the warning, but -W0 does. Strangely, changing that block to: no_warn do puts "foo" puts (0..5) end results in yet different warning behaviours. At any rate, a catchable warning system might be a good idea and encourage people to wrap 'warnable' code in blocks that don't emit particular warnings -- so something like: no_warn :method_redefined do # (meta)code that redefines methods end would explicitly turn off the method redefinition warning (presumably we are doing that on purpose here), but still emit any other warnings the code might generate. Just a thought. andrew -- Andrew L. Johnson http://www.siaris.net/ The generation of random numbers is too important to be left to chance.