Jean-Hugues ROBERT wrote:
> As a side note, you may want to consider a solution
> using blocks:
> 
> def trace( domain = :debug, &block )
>   if $domains[domain] then
>     p block.call()
>   end
> end

Nice. Small point: it's more efficient to use yield than to instantiate 
a Proc:

def trace( domain = :debug)
   if $domains[domain] then
     p yield
   end
end

Even if the trace is disabled, the &block construct will instantiate a Proc.