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

bachmeier no at spam.net
Sun Jul 29 21:37:56 UTC 2018


On Sunday, 29 July 2018 at 08:28:08 UTC, Walter Bright wrote:
> On 7/29/2018 1:15 AM, Manu wrote:
>> All we're asking for is that C++ namespaces do **nothing** 
>> except affect the mangling.
>
> If I do that, the next bug report will be:
>
>   extern (C++, "ab") { void foo(); }
>   extern (C++, "cd") { void foo(); } // Error, foo() is already 
> declared
>
>   foo(); // which one gets called?

mangle (C++, "ab") { void foo(); }
mangle (C++, "cd") { void foo(); } // Error, foo() is already

That would not require any changes to extern and there would be 
no sensible argument for trying to define foo twice.




More information about the Digitalmars-d mailing list