static unittest

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 30 10:21:58 PDT 2014


On 4/30/14, 10:00 AM, Vladimir Panteleev wrote:
> On Wednesday, 30 April 2014 at 16:55:06 UTC, Andrei Alexandrescu wrote:
>> Walter and I also discussed "static unittest" a while ago - yes,
>> another use of static :o).
>>
>> A static unittest would be evaluated only during compilation, and
>> would prove things that fall in the realm of static checking but are
>> not verifiable with traditional typesystem approach.
>>
>> That won't enable things we can't do today (there's always
>> assert(__traits(compiles, ...)) but it's instantly recognizable, very
>> easy to use, and pushes semantic checking to a whole new level.
>
> Isn't (__traits(compiles, ...) in a static assert redundant? All it does
> is replace one compilation error for another, additionally hiding its
> details.

Not if you want to compile statements. -- Andrei


More information about the Digitalmars-d mailing list