On 18.09.2016 22:10, Jonathan M Davis via Digitalmars-d wrote:
On Sunday, September 18, 2016 08:02:47 Andrei Alexandrescu via Digitalmars-d
> On 9/17/16 5:23 PM, Andrej Mitrovic wrote:
> > I think at some point someone suggested we could implement explicit
> > support for such unittests via `static unittest`:
> That suggests the unittest shall be evaluated during compilation. -- Andrei
How so? At this point, static as a keyword pretty much never means that
something is compile-time specific. This is using static in pretty much the
same sense that static constructors do.


A normal constructor goes with each
instance of a class or struct whereas a static one goes with the type.

Yes, this is consistent with all other usages of static declarations.

this case, a non-static unittest block would be compiled into each template
intsantiation, whereas a static one would be compiled once per template and
would not require that the template even be instantiated.

Yes, but those are actually not "pretty much the same".

The second feature does not exist for any kind of declaration, and it is not 'static'. If it is introduced, why limit it to unittests?

Reply via email to