-
-
Notifications
You must be signed in to change notification settings - Fork 672
Use lazy initialization for dmd.frontend #7789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
| */ | ||
| void initDMD() | ||
| { | ||
| import std.concurrency : initOnce; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not linking with Phobos - just druntime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file uses Phobos as it isn't part of the compiler.
|
I'm afraid I don't see how this improves anything. |
|
The |
|
What happens if |
Reinitialization is not so easy due to "inaccessible" globals: here's what I had to do in my experiments for Visual D some time ago: https://github.com/rainers/visuald/blob/dmdserver/vdc/dmdserver.d#L1009 |
| Expression._init(); | ||
| Objc._init(); | ||
| builtin_init(); | ||
| static shared bool initialized; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The front end is not thread safe, no need to pretend it here.
I was thinking if something bad can happen if |
| import dmd.arraytypes : Strings; | ||
| import std.string : toStringz; | ||
|
|
||
| initDMD; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please let's not introduce a new style for calling functions - append the ().
|
This just seems like over-engineering. Just use: Done - no import, no delegate, no dependencies, no "what does this do", etc. |
Lazy initialization seems to be the new game in town.
dmd.frontendwants to play with the big kids too!