Name lookups in D

Adam D. Ruppe destructionator at gmail.com
Fri Dec 11 01:38:44 UTC 2020


On Friday, 11 December 2020 at 01:34:13 UTC, kdevel wrote:
> Is this expected?

Yes, and this is kinda why I don't like using selective imports.

With a normal import, the module name is the only thing actually 
added to the scope. Everything in that module is found by walking 
the import chains after not finding it locally (unless you use 
`static import` which means it does not add it to the chain).

With a selective import, the only thing added is the specific 
name you did. The module name is NOT in scope and there is no 
chain established.

Selective imports are more like making an alias than other 
imports.


More information about the Digitalmars-d mailing list