Name lookups in D

Paul Backus snarwin at gmail.com
Sun Nov 15 22:38:08 UTC 2020


On Sunday, 15 November 2020 at 22:20:12 UTC, Dibyendu Majumdar 
wrote:
> This fails:
>
> module a.b.m;
>
> int hello() {
>    return 42;
> }
>
> extern (C) void main() {
>    assert (a.b.m.hello() == 42);
> }
>
> Is it supposed to?

Yes, the fully-qualified name of a module is not in scope unless 
you `static import` it.

There is one exception: you are always allowed to use a 
fully-qualified name on the right-hand side of an alias 
declaration. See <https://dlang.org/spec/declaration.html#alias>.


More information about the Digitalmars-d mailing list