On 19.09.2016 15:52, ag0aep6g wrote:
On 09/19/2016 02:55 PM, Timon Gehr wrote:
This works:
import std.stdio;
void main(){
    int x=3;
    enum l=()=>x;
    writeln(x);
}

I.e. l has the correct runtime context even though it is a static value.

Enums are a special kind of static value, though. Can't do that with
`static` instead of `enum`. Enums (often?) don't manifest until they're
used. Could .init work that way?

Maybe -- and local template instantiation should work for all arguments that require it. Then we would not have this issue. But fixing .init for local structs breaks code.

Reply via email to