Andrej Mitrovic napisał:

> Hmm.. ok. Adding immutable helps. I'm still a bit confused tho,
>  because this will not compile:
> 
> string input2 = "int y;";
> mixin(input2);

input2 is mutable, so theoretically there's no telling what value it holds.

> But this will compile:
> 
> immutable string input2 = "int y;";
> mixin(input2);

And good.

> And this too will compile:
> 
> string returnString(string input)
> {
>     return input;
> }
> 
> mixin(returnString("int y;"));

Because the function is *nice*, compiler can evaluate the call at compile-time 
(see my other post). Somewhere on the D page (Lang. Ref. > 
Functions ?) there's a largish explanation what's *nice*.

 
Tomek

Reply via email to