On Thursday, 20 August 2015 at 10:46:18 UTC, Timon Gehr wrote:
On 08/20/2015 05:55 AM, Andrei Alexandrescu wrote:
We need to fix the implementation. We can't promote imports
that hide
local symbols. -- Andrei
Great! We should probably agree on the precise new semantics
first though.
The current viable proposals in the bug report are:
- The symbols declared in the module at any scope nesting depth
hide the symbols in the local import, but all symbols in
imports in enclosing scopes overload against each other.
- No hiding of imported symbols by less deeply nested ones;
enclosing scopes are treated the same way as imports.
I'm not sure what's better. I think Scala does something
similar to the second proposal.
Yes, I'd advocate for the first one for 2 reasons:
- User has full control over module symbol, but may not have the
same over imported ones. We'd like to avoid hijacking local
symbols from imports as much as possible.
- We'd like to be able to lazy import as much as possible. If
import can hijack, then it is necessary to process them at least
enough to be able to do first level lookup, even if the import is
not used.