assert(condition[, message]) patch

kris foo at bar.com
Wed May 31 23:12:42 PDT 2006


Derek Parnell wrote:
> On Wed, 31 May 2006 21:38:04 -0700, Unknown W. Brackets wrote:
> 
> 
>>Walter,
>>
>>My most common use for having this is simple...
> 
> 
> Excellent reply and I'm now convinced too.
> 
> As a heretical aside, with the almost released new version of Build, you
> can do something like the C-styled assert macro.
> 
> You can define a macro replacement pattern such as ...
> 
>   regexp <:assert\s(.*)::(.*):>   =
>          if (!($1)) {writefln(`%%s:%%s`, `$1`, `$2`); assert(0);}
> 
> and then write in your code  ...
> 
>   <:assert result != 0::Bad result:>
> 
> which will transform into ...
> 
>   if (!(result != 0)) {writefln(`%s:%s`, 
>         `result != 0`, `Bad result`); assert(0);}
> 

I wish I could understand why this is needed in Build, Derek ... Build 
is truly great, at what it does well. Now it apparently allows one to 
intimately tie their code to Build, for all eternity, by extending the D 
language? Does this new stuff slow it down even a tiny bit?

Sorry if this comes off a bit negative, but Build is just so good as it 
is. Still, it is your baby :)



More information about the Digitalmars-d mailing list