On Friday, 1 July 2022 at 13:20:15 UTC, Mike Parker wrote:
r.

And that also looks like the source of your original segfault. You've got a circular reference going on in the constructors. In other words, you're constructing a global world instance, which in turn constructs an elf instance, which in turn accesses the global world reference whose constructor hasn't yet completed, so the global world reference is still null.


Here's what it looks like in code:

```d
import std.stdio : writeln;

class Foo {
    Bar b;
    this() { b = new Bar; }
    void sayMyName() { writeln("I am Foo."); }
}

class Bar {
    this() { f.sayMyName(); }
}

Foo f;

void main()
{
    f = new Foo;
}
```

Reply via email to