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

Manu turkeyman at gmail.com
Sun Jul 29 20:52:02 UTC 2018


On Sun, 29 Jul 2018 at 05:10, kinke via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> [...]
> so that a straight C++ namespace => D module hierarchy mapping
> would probably be required in the general case:
>
> ```
> // cppns/package.d
> module cppns;
> extern(C++, "cppns") { void foo(); }
>
> // cppns/nested/package.d
> module cppns.nested;
> extern(C++, "cppns") extern(C++, "nested") { void foo(); }
> ```

It's beautiful!

(but I added the quotes in there for you; without quotes is existing
defined behaviour which introduces scopes)


More information about the Digitalmars-d mailing list