Identifier resolution, the great implementation defined mess.

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 22 00:02:08 PDT 2014


On Monday, 22 September 2014 at 06:59:14 UTC, Walter Bright wrote:
> On 9/21/2014 11:09 PM, deadalnix wrote:
>> We should simply do a lookup for local symbol, and if that 
>> fail, imported symbols.
>
> That's what it does now, i.e. lookup in the current scope, and 
> if that fails, look in imports, if that fails, go to the 
> enclosing scope.
>

Can't this be made depth first ? That would seem more sensible to 
me, and apparently to other in this thread. After all, it seems 
legitimate to resolve what is under your nose than what is 
imported (and with lazy imports, it may even allow the compiler 
to process some imports).

>> In that case, a should resolve as the parameter, all the time.
>
> Parameters are in an uplevel enclosing scope.

Yes I know, there is good reason for that. But from the 
programmer perspective, not the implementer, that do not look 
right.


More information about the Digitalmars-d mailing list