[Prev][Next][Index][Thread]

Assert() and Friends



This has been puzzling me for a while, now...

In Dylan code I've seen, there are no Assert()-style macros for
debugging that I could see. This surprized me, as a debugging library
could easily be implimented with two sets of macros, one for test builds
one for final builds, that defined:

define macro assert
	{ assert( ?expression: ) }
	=>{ if( ?expression ) break(); end if; }
end macro assert;

in the debug version, and:

define macro assert
	{ assert( ?expression: ) }
	=>{}
end macro assert;

in the final version. To select test or final, you'd include the
relevent .lid which would build the relevent version under the same
library and package name.

Is this a good or bad idea, and why haven't I seen it? Have I just not
looked at enough code? :-)

- Rob

-- 
Rob Myers - http://www.robmyers.org/   
"Narafala dei mo narafala dei mo narafala dei, 
 Wokabaot snel-spid dei long dei..."
 - Ken Campbell, Wol Wantok.



Follow-Ups: