std.range and std.functional: use locally-scoped selective imports and document module-scope symbol imports#4379
std.range and std.functional: use locally-scoped selective imports and document module-scope symbol imports#4379andralex merged 2 commits intodlang:masterfrom joakim-noah:range_imports
Conversation
|
|
||
| import std.meta, std.traits; | ||
| import std.meta; // AliasSeq, Reverse | ||
| import std.traits; // isCallable, Parameters |
There was a problem hiding this comment.
AliasSeq is only called from one unittest block and Parameters from four templates, but if I make these two symbols into local selective imports and have only the two remaining symbols selectively imported at module scope, I started getting template instantiation errors. Not sure what's going on, so just moved those two up here.
…imported at module scope, checked with ddmd
…bols imported at module scope, checked with ddmd
Great catch! |
|
No, nothing affecting my motivation, I just stopped here. I want to automate the rest, thought I'd use these import PRs I manually modified and submitted as training data for that. I know PRs sometimes take awhile to get in, doesn't affect me. |
|
great work, thx! |
Checked with ddmd, similar to #4365.
Update: I was getting a lot of shared ctor cycles in the auto-tester from updating
std.range, which appeared to be from importingstd.algorithm.comparisondirectly instead ofstd.algorithm. I tried changing all those instances tostd.algorithmand that fixed it, but seemed like a hack. If I simply didn't touch the pre-existing uses ofstd.algorithmfor symbols fromstd.algorithm.comparisonand didn't change the few pre-existing direct imports ofstd.algorithm.comparison, the cycle still came up, ie simply from adding or modifying other imports. That seems like a bug.Rather than going back to importing the package
std.algorithmeverywhere, I went down the list of imports in the cycle, conveniently listed by the druntime error, and found it was enabled by a stray, unused local import ofstd.stdioinstd.functional, so I removed that import and went ahead and used all selective imports forstd.functionaltoo.