March 07, 2008
Robert Fraser wrote:

> 
> Compile-time values could evaluate to true, and compile-time code generation could very easily create code that would seem silly to write directly. So it's a valid problem.
You are right, this is a problem.

Interestingly, mixing in the ThenStatement works fine:

----
if (true)
    mixin ("scope(exit) Stdout(\"hello \").newline;");
// prints hello as expected.
----

I guess, this is because a string mixin creates a new scope, which is a bug (or a feature? The specification is not specific on that):

----
mixin ("scope(exit) Stdout(\"Exiting scope.\").newline;");
Stdout("After mixin").newline;
----

outputs:
Exiting mixin scope.
After mixin

while I would expect the reverse.







1 2
Next ›   Last »