Names and scope in D

Dibyendu Majumdar mobile at majumdar.org.uk
Sat Nov 28 16:04:34 UTC 2020


On Saturday, 28 November 2020 at 15:52:00 UTC, Adam D. Ruppe 
wrote:
> On Saturday, 28 November 2020 at 15:39:48 UTC, Dibyendu 
> Majumdar wrote:
>>
>> struct scopes {}
>> int scopes;
>
> That's overloading, not shadowing. How would you disambiguate 
> that in a case like:
>
> template foo(alias a) {}
>
> foo!scopes; // which scopes?
>
> You can have any one but not both like this. With the module 
> name though you can specify scopes.scopes or .scopes and such 
> to specify.

Yes I got that. I am trying to understand why it isn't ambiguous. 
I don't see anything in the grammar that clarifies this.

I am guessing an unqualified name, other than if it appears in 
module statement or import statement, can never be a module name. 
Is that correct?


More information about the Digitalmars-d mailing list