D beginner's article about D's Metaprogramming and Testing

Renato renato at athaydes.com
Wed Dec 20 21:57:25 UTC 2023


On Tuesday, 19 December 2023 at 23:56:59 UTC, Steven 
Schveighoffer wrote:
> On Sunday, 17 December 2023 at 21:51:59 UTC, Renato wrote:
>> Hi.
>>
>
> I see what you are going for, but the static if *block* is 
> included or excluded based on what the compile-time condition 
> is. The *condition* is executed at compile time, and if the 
> condition is true, the block exists, if not, it doesn't exist. 
> But in the case of your code, clearly the block exists at 
> runtime (you are adding 2 runtime values together).

I've edited the post to clarify this.


> Regarding more descriptive unittests, try out the compiler 
> parameter `-checkaction=context` to get more descriptive 
> asserts: https://dlang.org/dmd-osx.html#switch-checkaction

I got this working, obviously I forgot the `-main` flag before... 
too many flags to remember, I need to start using dub I suppose.

Also, added a note mentioning this and linked to your post.

Thanks!


More information about the Digitalmars-d mailing list