[Issue 15966] [REG 2.071] {public,protected} imports in base class ignored on symbol lookup

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue May 17 04:31:52 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=15966

--- Comment #11 from Mathias Lang <mathias.lang at sociomantic.com> ---
(In reply to Walter Bright from comment #8)
> (In reply to Mathias Lang from comment #6)
> > A base class in another module can
> > already override global imports by introducing new local symbols.
> 
> The problem is if symbols are added to that import, then they have an
> unintended side effect of overriding local symbols in the derived class code.
> 
> Again, this is exactly the kind of problem this change was designed to stop.

They will only override imported symbols from outer scopes, not local ones. So
it would override module imports, but not module aliases, for example.
The same problem exists for mixin template, and by extension any "non-final
scope" have this "issue", but the recent change are much more sane and easy to
work with.

If you don't want this behavior, then `import` from base classes should not be
visible at all (even within the same module), or we'll end up in a weird place
with 2 or more different rules.

There is a better description of how I thought it would / should work as part
of:
https://issues.dlang.org/show_bug.cgi?id=16004

--


More information about the Digitalmars-d-bugs mailing list