Eliminate assert and lazy from D?

Steven Schveighoffer schveiguy at yahoo.com
Tue Oct 13 08:56:55 PDT 2009


On Tue, 13 Oct 2009 08:21:44 -0400, Jason House  
<jason.james.house at gmail.com> wrote:

> Andrei Alexandrescu Wrote:
>>
>> It's simpler actually:
>>
>> debug void assert(T)( T expr, string delegate() msg ) {
>>      if(!expr)
>>          throw new Exception(msg);
>> }
>> else void assert(T)( T delegate(), string delegate() ) {
>> }
>>
>> Hm, actually it's more complicated than your version :o).
>>
>>
>> Andrei
>
>
>
> You should be throwing AssertError
>
> I really like lazy for log messages and asserts. I like the implicit  
> cast to (scope) pure delegate idea. It works well in those contexts.

With macros, this can be solved without lazy.

I'd say work on getting macros working, then drop lazy and assert.

-Steve



More information about the Digitalmars-d mailing list