DIP61: redone to do extern(C++,N) syntax

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 29 08:43:45 PDT 2014


On 04/29/2014 01:34 PM, Simen Kjærås via Digitalmars-d wrote:
>
> Building on this knowledge:
>
> module foo;
>
> void func();
>
>
> module bar;
>
> extern(C++, foo) void func();
>
>
> module prog;
>
> import foo;
> import bar;
>
> void main()
> {
>      // Seems like it's ambiguous between foo.func and bar.foo.func.
>      foo.func();
> }

It will call foo.func, because the module foo is in scope in module prog 
and hence hides the namespace foo in module bar.

You can already try this today, as the DIP _does not actually introduce 
any new lookup rules_:

module a;
void func(){}
//---
module bar;

mixin template X(){
     void func();
}
mixin X foo;
//---
import foo,bar;

void main(){
     foo.func();
}

In particular, any problems you find with symbol lookup are actually 
orthogonal to the DIP.


More information about the Digitalmars-d mailing list