On Sun., 29 Jul. 2018, 7:20 pm Walter Bright via Digitalmars-d, <digitalmars-d@puremagic.com> 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?
 
ab.d
------
module ab;
extern(C++, "ab") void foo();


cd.d
------
module cd;
extern(C++, "cd") void foo();



Perfect!


In 20 years, I've never seen 2 namespaces in the same file. And if the C++ code were like that, I'd break it into separate modules anyway, because that's what every D programmer would expect.
Normal D module divisions map perfectly to every C++ program I've ever wanted to bind to yet.

Conversely, single namespacs spread across many files appear all the time, and the current solution with disconnected namespaces scoped beneath the modules is extremely un-C++-like and problematic.

> You must have missed my other post:
> [...]

No, I feel like you've missed literally every post I've ever made on the topic.
We ***do not want to use extern(C++) to scope and organise code***! That's what modules are for.
D has modules, and they're good, and that's how we want to organise our code. I feel like I've conveyed that clearly.
It doesn't need to be harder than that. We're perfectly happy with the way D works in every other case. We don't want 'cases' here.

I can't understand your arguments saying the simpler design (ie, D modules) are complex, and cause for a torrent of bug reports.
I haven't seen any bug reports about D modules making it impossible to organise code, and if that were true, then we have a serious problem with D's module design which carries WAAAY beyond extern(C++).

I understand you're ideologically attached to this idea, and that's fine; I don't want to take anything away from you.
We have what already exists, that can't go away now, but please just give us string namespaces as a mangle-only option. Not only will I shut up about it forever, but we will also be able to specify namespaces that conflict with D keywords, and also organise our modules just like all other D code ever.