-
-
Notifications
You must be signed in to change notification settings - Fork 740
Start using the ddmd frontend to more narrowly scope imports #2809
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
…frontend to dump all import symbols
I think I'm done with Since I can't make them selective yet, I documented the symbols imported by the remaining module-scope imports in comments. I was able to remove some static imports after more narrowly scoping This PR is now ready for review. If these kinds of changes are found worthwhile, I may submit more PRs for other modules. |
Updated this pull to localize symbols where possible from module-scope imports Should be finally done now. |
Looks nice but I worried if some symbols are only required on some platforms and not the other. |
The auto-tester did catch some of these for me on FreeBSD or Windows that ddmd didn't, since I was only running the ddmd frontend for linux. If the test coverage isn't complete, it's possible that some other missed dependency slipped through. But maybe that's a reason to do it anyway, to help us find where the test coverage needs to be improved? |
@@ -17,13 +17,12 @@ Authors: $(WEB digitalmars.com, Walter Bright), | |||
module std.stdio; | |||
|
|||
public import core.stdc.stdio; | |||
static import core.stdc.stdio; | |||
import std.typecons : Flag; |
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.
Why was a selective import replaced with a regular import? Seems like it's doing the opposite of what we need.
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.
I laid out the reason in my second comment above. Issue 314 is that selective imports at module scope are currently always public, ie those symbols are leaked into any module that imports this module. Since this selective import was added between major releases, I thought it best to reverse it, until issue 314 is fixed, so that it won't leak in the next release.
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.
Ah right, forgot about that. Cool. :)
Yeah I think we need to have some kind of But that's another step for later. This mostly LGTM. Will have another deeper look later and merge. |
Auto-merge toggled on |
Start using the ddmd frontend to more narrowly scope imports
I just modified the ddmd frontend to dump all imported symbols, based on Daniel's newmagic ddmd branch from a couple weeks back. I was able to make these small cleanups by running this modified ddmd on
std.stdio
and looking for places to tighten up the imports, doing more soon.I'm posting this PR early so that it can be looked over as I go, and run through the auto-tester.