Names and scope in D
snarwin at gmail.com
Sat Nov 28 19:36:25 UTC 2020
On Saturday, 28 November 2020 at 15:16:11 UTC, Dibyendu Majumdar
> On Saturday, 14 November 2020 at 17:06:49 UTC, Dibyendu
> Majumdar wrote:
>> I couldn't find the rules that D uses to decide whether a name
>> conflicts or not. If I missed something please can someone
>> point me to it?
> module scopes;
> int scopes;
> This is accepted by the compiler which surprised me.
> Is this intentional?
The reason these do not conflict is that they are not in the same
scope. `int scopes` is inside the module (FQN: scopes.scopes),
whereas `module scopes` *is* the module (FQN: scopes).
More information about the Digitalmars-d