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?

The reason namespaces were added to C++ is to not have such name collisions. Namespaces in C++ introduce a scope. D cannot interoperate with this without introducing a scope as well.

Wouldn't something like this would prevent that :

   extern (C++, "ab") { void foo(); }
extern (C++, "cd", "s") { void foo(); } // s is an optional D scope

   foo(); // works
   s.foo(); // works too

Of course, it will imply some syntax change on the extern keyword, as a new optional parameter will be added.

Reply via email to