At 18:23 05/06/2004 +0900, you wrote:

>"David Garamond" <lists / zara.6.isreserved.com> schrieb im Newsbeitrag
>news:40C18065.8000704 / zara.6.isreserved.com...
>> Paul Brannan wrote:
>> > On Sat, Jun 05, 2004 at 05:51:44AM +0900, Jean-Hugues ROBERT wrote:
>> >
>> >>if DEBUG
>> >>  def assert
>> >>    raise "assertion failure" unless yield
>> >>  end
>> >>else
>> >>  def assert; end
>> >>end
>> >>
>> >>There is some overhead when not in DEBUG mode, but that
>> >>is the best you can do in Ruby as far as I know.
>> >
>> > That's the best I know of that you could do in pure ruby.
>>
>> Is anyone using cpp (C preprocessor) along with Ruby? I've always wanted
>> to use it, but my laziness prevails everytime :-)
>
>Aaaargh!  Even Bjarne would be glad of getting rid of this fossile and you
>walk around freely and try to get people to use it!  Get hold of him, arrest
>him, put him in chains...
>
>:-))
>
>Seriously, who needs CPP when there is Ruby?
>
>def load_special(file)
>  if DEBUG
>    load file
>  else
>    Object.new.instance_eval File.read(file).gsub(/^\s*assert\b/m, '#' )
>  end
>end
>Regards
>    robert

Cool !
Now. What about multi-lines asserts ?
If that helps I may concede a end-of-xxx marker.

Yours,

Jean-Hugues


-------------------------------------------------------------------------
Web:  http://hdl.handle.net/1030.37/1.1
Phone: +33 (0) 4 92 27 74 17