Identifier resolution, the great implementation defined mess.
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Sun Sep 21 23:36:58 PDT 2014
On 21/09/14 22:04, Walter Bright wrote:
> Lookup rules are straightforward:
>
> scope is current scope
> do {
> look up name in scope
> if name is found, done!
> look up name in imports imported into scope
> if name is found, done!
> set scope to enclosing scope
> } while scope exists
>
> I don't know what mental model people have for how lookups work, but the
> above algorithm is how it actually works.
You better write down the scope rules as well. It gets complicated with
base classes, template mixins and all features available in D.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list