[Issue 10378] Local imports hide local symbols

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Sep 23 14:10:02 PDT 2014


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

deadalnix <deadalnix at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |deadalnix at gmail.com

--- Comment #9 from deadalnix <deadalnix at gmail.com> ---
Proposal:

Free symbol are resolved from the inner scope to the outer scope WITHOUT
considering imports. If that lookup fails, the symbol is searched in import
from the inner scope to the outer scope.

A variant is to aggregate import into the inner scope.

This solution has various advantages:
 - import cannot hijack in module symbols implicitly.
 - import do not need to be processed if local lookup succeed, and doing less
work is always a way to make the compiler faster.

The main difference between the first proposal and the variant is that that in
the first proposal, an inner imported module's symbol can hijack an outer
imported one. In the variant, it doesn't happen, but the import lookup phase
will be much heavier, as the compiler must look into all imported module at
once.

--


More information about the Digitalmars-d-bugs mailing list