Is there any good reason why C++ namespaces are "closed" in D?

Jacob Carlborg doob at me.com
Tue Jul 31 10:35:02 UTC 2018


On 2018-07-31 10:12, Manu wrote:

> Given your favourite example:
> ----
> module a;
> extern(C++, ns) void foo();
> ----
> module b;
> extern(C++, ns) void foo();
> -----
> module c;
> import a, b;
> foo(); // error: ambiguous
> ns.foo(); // error, ambiguous (obviously)
> a.ns.foo(); // naturally, this works... it's the D module that
> correctly organises the symbol. 'ns' is worthless here

This works:

a.foo();

You don't need "ns" in between the module name and the function.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list