Mixin namespace ambiguity?

Marek Janukowicz marek at janukowicz.net
Mon Sep 16 13:28:05 PDT 2013


Kenji Hara wrote:
> Currently this is not a bug.
> 
> Looking from the module 'main', the mixin identifier 'X' declared
> in main.d is *closer* than the 'X' declared in aux.d, because the
> latter exists beyond the module import boundary.
> Therefore, the use of 'X' in main.d would prefere the `mixin
> A!("a in main") X`.

I get this one - if X was eg. a class and I was calling it's static member 
it would work the same way.

> On the other hand, when the name search, all mixed-in symbols are
> treated as if they are just imported at the mixed-in scope.

Could you please elaborate a bit more or point me to some documentation 
where this is described? If the mixins are imported at mixed-in scope, my 
understanding would be the one in 'main' is closer than the one in 'aux'.

> Therefore, even from main.d, the two mixed-in functions 'a' have
> same closeness, and the call is ambiguous because they have
> exactly same signature.


-- 
Marek Janukowicz


More information about the Digitalmars-d-learn mailing list