extern(C++, ns) is wrong

Manu turkeyman at gmail.com
Thu Sep 13 22:43:47 UTC 2018


On Thu, 13 Sep 2018 at 13:01, Jonathan M Davis via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> Walter's concerns seem to center around the idea that we somehow need to
> model C++ namespaces in D, so that's really what needs to be addressed
> somehow. The D module system gives us everything we need to lay out symbols
> so that they don't conflict. The only thing that it can't do is allow you to
> put conflicting symbols in the same module, making it harder to have a
> 1-to-1 correspondance between D modules and C++ header files in rare cases,

But consider the overwhelmingly common case where C++ namespaces span
across many files.
You can't distribute extern(C++, ns) across D modules, so D fails to
model C++ namespaces regardless, and in the vast majority case. The
minority case you point out above is irrelevant by contrast.
The current design fails at its primary goal right out of the gate,
but we wear a pile of super-anger-inducing baggage in its wake.


More information about the Digitalmars-d mailing list