On 19.09.2016 14:35, ag0aep6g wrote:
On 09/19/2016 02:24 PM, Lodovico Giaretta wrote:
Oh. I didn't thought about that. This means that in the following
example, the initialization of `s` is more than a simple call to
`S.init`. I was under the impression that in D `S.init` should represent
a valid state for whatever type `S`.

Yeah, .init and nested structs don't really fit together. On the one
hand .init is supposed to be a valid value. On the other hand it must be
a static value. Can't have both with nested structs. Maybe they
shouldn't have .init at all.

This works:
import std.stdio;
void main(){
    int x=3;
    enum l=()=>x;

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

Reply via email to