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

Nicholas Wilson iamthewilsonator at hotmail.com
Mon Jul 30 02:53:43 UTC 2018


On Monday, 30 July 2018 at 02:15:57 UTC, Walter Bright wrote:
> On 7/29/2018 1:45 PM, Manu wrote:
>> There's no way you'll get a bug report from someone 
>> complaining they
>> can't multiply define symbols in the same scope. That's common 
>> sense.
>
> But then you cannot interface with this C++ code:
>
>     namespace ab { void foo(); }
>     namespace cd { void foo(); }
>
> Why would you find this acceptable?

But you can if ab and cd are in different modules. The point is 
to decouple the mangling from the scope, leave the scope to D's 
module system, leave the mangling to extern(C++, "foo")


More information about the Digitalmars-d mailing list