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

Manu turkeyman at gmail.com
Sat Jul 28 18:28:25 UTC 2018


On Fri., 27 Jul. 2018, 3:55 pm Walter Bright via Digitalmars-d, <
digitalmars-d at puremagic.com> wrote:

> Namespaces are a botch in C++, and it is understandable that C++ code
> bases
> naturally have grown willy-nilly to utterly ignore any encapsulation
> principles.


Correct. And D has modules. Solved.

Literally nobody has ever wanted to use a C++ namespaces as a means of
encapsulation in D. We *just* want to mangle our symbol name. We want to
keep our code organised consistently with all other D code.

Please, please, please... Please, please please please please please PLEASE
support extern(C++, "string_ns") as a mangle-only variant.

Current behaviour can coexist, but let us have a way to express a mangling
request without changing the organisation of our D code.

I suggest accepting string, since that will allow us to also access C++
namespaces that conflict with D keywords.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20180728/9a95c43b/attachment.html>


More information about the Digitalmars-d mailing list