Identifier resolution, the great implementation defined mess.

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 20 23:56:49 PDT 2014


V Sun, 21 Sep 2014 08:41:26 +0200
Sönke Ludwig via Digitalmars-d <digitalmars-d at puremagic.com> napsáno:

> Am 21.09.2014 07:29, schrieb deadalnix:
> > On Friday, 19 September 2014 at 10:59:24 UTC, Dicebot wrote:
> >> Yeah this is exactly what I was asking about. I assumed that
> >> deadlnix has done some research about it and found some specific
> >> inconsistencies / issues - after all, it is not the only
> >> implementation-defined feature he must have encountered :)
> >
> > DMD does very bizarre things. I think I should write a DIP, but
> > time is always running low...
> >
> > Free goodie: when you import, all symbol are resolved via the
> > expected import resolution mechanism. All ? No, the root package is
> > imported in the local scope.
> >
> > foo(int a) {
> >    import a.b.c;
> >    // a is now a package and not the parameter a anymore.
> > }
> 
> There are also funny little things like this one:
> http://dpaste.dzfl.pl/aac84d5ffae8
> 

Yep, this is reason why I do not use local imports for all symbols.
When I need local import of something, then I import just what I really
need with alias:

http://dpaste.dzfl.pl/0fe84e060f718



More information about the Digitalmars-d mailing list