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

rjframe dlang at ryanjframe.com
Thu Aug 2 10:28:13 UTC 2018


On Wed, 01 Aug 2018 16:04:01 -0700, Walter Bright wrote:

> On 8/1/2018 10:24 AM, Jonathan M Davis wrote:
>> Not to say that that can't work, but I have to say that it seems pretty
>> ugly if using extern(C++, NS) requires a bunch of aliases just to use
>> symbols normally.
> 
> What is normal is a slippery concept, especially when one is comparing
> different lookup rules between languages. D modules do not a 1:1
> correspondence with C++ namespaces, either (not even close).

Disclaimer: no knowledge or experience to back up my assumptions:


This is the part of the discussion I don't understand. Why do we need to 
care about [all of the] C++ lookup rules? Even if the D compiler has to 
know about them, I'd think it's an implementation detail on the D side 
that wouldn't necessarily need to be passed to the user.

If the goal is to link with C++ object files, the only thing that matters 
is what's available in those files, right? Anything to do with C++ rules 
that doesn't achieve this goal seems like it's just noise to me.


More information about the Digitalmars-d mailing list