On 12/2/2014 2:00 PM, H. S. Teoh via Digitalmars-d wrote:
However, there are major issues with scoped imports currently,
that make this otherwise ideal solution less-than-ideal, which stem from
the way 'import' is implemented in D. When the compiler encounters an
'import' statement, what it essentially does is to parse the symbols in
the target module, and add them to the symbol table for the current
scope.

No, it does not. Each scope has a symbol table of symbols declared in the current scope,

  https://github.com/D-Programming-Language/dmd/blob/master/src/dsymbol.h#L298

and it has an array of imported symbol tables:

  https://github.com/D-Programming-Language/dmd/blob/master/src/dsymbol.h#L301

Only if the symbol is not found in the current scope,

  https://github.com/D-Programming-Language/dmd/blob/master/src/dsymbol.c#L902

it then looks in the imported symbol tables:

  https://github.com/D-Programming-Language/dmd/blob/master/src/dsymbol.c#L910

Reply via email to