[expression.d] restrict import of dmd.globals - #23467
Conversation
|
This whole get method looks off, similar to #23466 Why do these get methods even exist? They store nothing useful. It should be using the existing OOP pattern, with an instance global that is allocated statically. To handle class Foo {
static Foo instance() @trusted {
__gshared Foo foo = new Foo;
return foo;
}
}Or just (should work): class Foo {
static Foo instance = new Foo;
} |
Using a pre-allocated instance can be slightly more efficient for the compiler, but when using dmd as a library for Visual D it must not lose the original expression/statement in case of error, so that it can still be iterated over and (partial) information can still be provided to the user. So the get method is patched to save the original expression within a new |
Please upstream this! |
No description provided.