From: David Garamond Date: 2004-06-05T19:26:28+09:00 Subject: Re: Check assertion in Ruby Robert Klemme wrote: >>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 I don't think preprocessing is obsolete as a concept. We can still do cool/useful stuffs with preprocessing, e.g. embedding license text, templates, obfuscation, adding/removing comments, removing debugging code, etc. I still think preprocessing interesting because Ruby hasn't done dead-code-removal optimization like Python does (if __debug__: ..., IIRC, haven't touched Python in ages). And your example won't work with precompiled Ruby bytecode in the future :-) -- dave