[Prev][Next][Index][Thread]
Re: Assert() and Friends
Sounds perfectly reasonable to me (as long you have no
dependencies on Mindy and no assert from another
library imported). Probably nobody bothered yet
because dylan will signal an error anyway later if
something is wrong i.e. if there is some type or other
semantic error. That runtime error is also rather
informative. The logical consequence of your assert
macro is design by contract (DBC) popularized by
Eiffel. Some adventurous soul has written a DBC
package for Common Lisp some time ago, maybe you could
take ideas from that. I could dig up the
comp.lang.lisp article if you want, or just visit
deja.com.
Gabor
--- Rob Myers <robm@h2g2.com> wrote:
> 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.
>
>
>
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
Follow-Ups:
References: