Is there any good reason why C++ namespaces are "closed" in D?
tide
tide at tide.tide
Mon Aug 6 22:19:50 UTC 2018
On Monday, 6 August 2018 at 20:35:37 UTC, Walter Bright wrote:
> On 8/6/2018 11:26 AM, tide wrote:
>> What's your crossplatform workaround if I have a namespace
>> named "version" or "package" ?
>
> See my reply to Rick Cattermole.
> https://digitalmars.com/d/archives/digitalmars/D/Is_there_any_good_reason_why_C_namespaces_are_closed_in_D_317277.html#N317507
But that's not currently implemented is it? Your proposed
solution adds an exception to the rule that just increases
complexity of the language. No where else does "__" remove itself
from the name it is used with. With the syntax extern(C++, "...")
it is more easily understood, no crazy exceptions need to be made.
>> You also didn't mention your reasoning behind not including a
>> way to use const pointers to mutable data.
>
> That's a longstanding issue and has nothing to do with
> namespaces.
That's just a deflection, we are talking about C++ name mangling,
not namespaces. How do you mangle const pointers to mutable data
in D to be able to call C++ ? You don't need to implement the
feature, you just need a way to create the C++ mangle, which
there is none. The only way is to change C++ code, like you said,
telling people to rewrite their code is never, ever going to work.
More information about the Digitalmars-d
mailing list