<div dir="ltr"><div dir="auto"><div><div class="gmail_quote"><div dir="ltr">On Sun., 29 Jul. 2018, 7:20 pm Walter Bright via Digitalmars-d, <<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 7/29/2018 1:45 PM, Manu wrote:<br>
> There's no way you'll get a bug report from someone complaining they<br>
> can't multiply define symbols in the same scope. That's common sense.<br>
<br>
But then you cannot interface with this C++ code:<br>
<br>
     namespace ab { void foo(); }<br>
     namespace cd { void foo(); }<br>
<br>
Why would you find this acceptable?<br></blockquote></div></div><div dir="auto"> </div><div>ab.d</div><div>------</div><div></div><div dir="auto">module ab;</div><div dir="auto">extern(C++, "ab") void foo();<br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">
<div>cd.d</div><div>------</div><div></div><div dir="auto">module cd;</div><div dir="auto">extern(C++, "cd") void foo();<br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div>Perfect!<br></div>

</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">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.<br></div><div dir="auto">Normal D module divisions map perfectly to every C++ program I've ever wanted to bind to yet.</div><div dir="auto"><br></div><div>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.</div><div><br></div><div>> 
You must have missed my other post:

<br></div><div>> [...]<br></div><div><br></div><div>No, I feel like you've missed literally every post I've ever made on the topic.</div><div>We ***do not want to use extern(C++) to scope and organise code***! That's what modules are for.</div>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.<br><div>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.<br></div><div><br></div><div>I can't understand your arguments saying the simpler design (ie, D modules) are complex, and cause for a torrent of bug reports.</div><div>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++).</div><div><br></div><div>I understand you're ideologically attached to this idea, and that's fine; I don't want to take anything away from you.</div><div>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.</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>
</div>