On 18.09.2016 22:52, Jonathan M Davis via Digitalmars-d wrote:
On Sunday, September 18, 2016 13:10:36 Jonathan M Davis via Digitalmars-d
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. --
How so? At this point, static as a keyword pretty much never means that
something is compile-time specific.
Actually, static does mean compile-time in the case of static assert, so
there is at least once case where it does, but most uses of static mean
something else, and you have to know the context to know what the static
keyword means. I selected static, because this use case fit reasonably well
with how it was used with constructors, and it didn't require a new keyword
- static in front of a statement is a declaration running the statement
at compile time in an appropriate sense.
- static in front of a declaration means that the declaration does not
use a context pointer.
static unittest does not fit this pattern.
But the word static itself isn't the important part. It's the
feature, and something else could be used.