Identifier resolution, the great implementation defined mess.
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Mon Sep 22 02:16:40 PDT 2014
On 9/22/2014 12:02 AM, deadalnix wrote:
> 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).
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 :-(
>>> 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.
I don't know of a better rule.
More information about the Digitalmars-d
mailing list