Identifier resolution, the great implementation defined mess.
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Mon Sep 22 13:50:13 PDT 2014
On 09/22/2014 10:27 PM, deadalnix wrote:
> On Monday, 22 September 2014 at 09:17:16 UTC, Walter Bright wrote:
>> It is depth first. It starts at the innermost scope, which is the
>> current scope. Somehow, we don't seem to be talking the same language :-(
>>
>
> Depth first in the sense, go from the inner to the outer scope and look
> for local symbols. If that fails, go from the inner to the outer and
> look for imported symbols.
That sounds almost right, but it still suffers from hijacking issues,
because more nested (non-explicitly!) imported identifiers would hide
less nested ones.
What about:
Go from nested to outer scopes and look for local symbols. If that
fails, look up the symbol simultaneously in all modules that are
imported in scopes enclosing the lookup.
I currently think this would be the most sane behaviour for imports. It
would need to be determined what to do about template mixins.
More information about the Digitalmars-d
mailing list