Are selective imports supposed to always be public?
Jonathan M Davis via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Dec 6 04:03:12 PST 2015
On Sunday, December 06, 2015 11:10:44 Mike Parker via Digitalmars-d-learn wrote:
> On Sunday, 6 December 2015 at 10:31:58 UTC, tsbockman wrote:
> > Why does this code compile? Shouldn't the `isIntegral` import
> > be private to module `testB` unless I explicitly ask for it to
> > be public?
> >
> > // testB.d
> > module testB;
> >
> > import std.traits : isIntegral;
> >
> > // testA.d
> > module testA;
> >
> > void main(string[] args) {
> > import testB;
> > static assert(isIntegral!int);
> > }
>
> A very old bug.
>
> https://issues.dlang.org/show_bug.cgi?id=314
Yeah. At this point, you should basically never use selective imports at the
module-level.
As I understand it, work has been done towards fixing this bug and some
related bugs recently, but the compiler devs aren't in agreement on the
changes. So, for the moment at least, the bug continues to be a problem, but
there's a good chance that it'll get fixed semi-soon.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list