On 23 Aug 2005, at 21:06, Zed A. Shaw wrote:

> One of the things that's really great about agile languages is they  
> give you the power to do anything.  One of the most horrible things  
> about agile languages is they give every other idiot the same power  
> to stab you in the back with a rusty pitchfork.
>
> I needed to do some simple logging.  I made a Logger class and  
> started writing to it.  Hmm, my log messages sometimes have a  
> format and sometimes they don't.  Nothing I do fixes this.
>
> Three hours later and half my sanity, I start to snoop through the  
> libraries I've included, and I find this wonderfully horrible gem:
>
> http://rafb.net/paste/results/0vADxJ56.html

Oh? You think that's bad?

There's also this gem sitting right next to it.

def silence_warnings
   old_verbose, $VERBOSE = $VERBOSE, nil
   begin
     yield
   ensure
     $VERBOSE = old_verbose
   end
end

So that things like this can be done:

silence_warnings { Customer = Struct.new("Customer", :name) }

instead of doing something simple like:

unless defined? Customer
   Customer = Struct.new "Customer", :name
end

-- 
Eric Hodel - drbrain / segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04