On Wednesday, 18 July 2018 at 12:10:18 UTC, baz wrote:

Specs are clear : it's a global so it's evaluated at compile time (https://dlang.org/spec/declaration.html#global_static_init)

Example code should not compile.

Indeed. Inside a function it does actually work.
And ofcourse for

class Test {
 List ls = 1;
}

it's going to make a static initializer which is then copied during construction of Test, so that's never going to work with the &this.

Reply via email to