Consider the following code:
static if (!is(MyStruct))
{
struct MyStruct
{
}
}
static if (is(MyStruct))
{
static assert(0);
}
My original understanding has been that the order of declarations (in global scope) does not matter in D.
However, in this case, the order of the static if
s makes the difference between whether or not the program compiles.
Is D's compile-time evaluation stage, therefore, a procedural feature (like C/C++), a declarative feature, or something else? What is it currently, and what is it planned to be (if the two are different)?
I just realized, the problem doesn't even end here. What happens of a static if
uses .tupleof
to enumerate the members of the current module, and create the same type of problem?
It's a declarative feature that has procedural properties as a side effect of the implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With