From: Paul Brannan Date: 2003-08-20T03:55:14+09:00 Subject: Re: $VERBOSE=true returns warnings from standard library On Wed, Aug 20, 2003 at 12:12:47AM +0900, Dave Thomas wrote: > However, there are also times where the developer knows more than the > interpreter. For those cases, how about a standard facility to allow > warnings to be disabled for a chunk of code (a la Perl)? What would it mean for warnings to be disabled for a chunk of code? Would this happen at compile-time or at run-time? If I enable warnings for a chunk of code, then would warnings be on or off for code that this chunk happens to call? I'd really like to see a pluggable mechanism for capturing warnings (instead of sending all warnings to stderr). It would be really nifty if I could write: def warn(warning) if warning.level < 10 or warning.file == "a_file_I_want_to_ignore_warnings_in.rb" then # ignore this warning else $stderr.puts(warning) send_email_to_me_about(warning) end end class Foo def foo; end def foo; end # doesn't print anything since the warning's level is # too low end Paul