From: Robert Klemme Date: 2004-02-26T22:49:48+09:00 Subject: Re: proposal: debug keyword ------=_NextPart_000_01EB_01C3FC77.8A107CF0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit "Simon Strandgaard" schrieb im Newsbeitrag news:pan.2004.02.26.13.08.27.945491@adslhome.dk... > On Wed, 25 Feb 2004 13:16:50 +0100, Simon Strandgaard wrote: > [snip] > > I think this would be a good idea to have distributed with Ruby? > > I am thinking of submitting an RCR, should I do this? > > > > Question still stands, should I make an RCR out of it? > > > Consideration if the name 'debug' is ok? When switching debugging for certain methods "debug_method" is more appropriate IMHO. "debug" implies some global thingy. My 0.02 EUR... > Temporary enabling a global flag is more general, > perhaps its better to make a temporary-set method > > temp_set $global_variable, :method > > Instead of naming it 'debug', then maybe name it > > temp_set_debug :method > > > What should be in the RCR? > the 'temp_set' thing or the 'debug' keyword thing? > > > Sorry for rambling.. needs more input ;-) Hm... Just as food for thought: how about some more aspect oriented solution, i.e., debug aspects to switch on and off (see attachment). Regards robert ------=_NextPart_000_01EB_01C3FC77.8A107CF0 Content-Type: application/octet-stream; name="debug-2.rb" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="debug-2.rb" #!/usr/bin/ruby module Kernel def debug_on(*aspects) Kernel.debug_switch(true, aspects) end def debug_off(*aspects) Kernel.debug_switch(false, aspects) end def debug(aspect) yield if Kernel.debug? aspect end class <