On Monday, 30 July 2018 at 20:23:25 UTC, Walter Bright wrote:
On 7/30/2018 9:45 AM, Manu wrote:
Sure it 'works', but it's an annoying point of friction, and it
doesn't need to be that way.
You can reduce it to:
mixin(cppNamespace("ns", "void foo();"));
You haven't explained why you can't just move the namespace
ns declarations in
one file together.
Are you serious?
Yes, please explain why you can't coalesce the namespace
declarations in one C++ file into one namespace declaration.
Because one C++ file != one C++ translation unit. All of them
will #include other files and need the symbols in them, which,
for anything using namespaces (the standard library, boost, ...),
will mean several instances of opening and closing the same
namespace.
The only good way (I don't think the mixin template and struct
solutions count) to link to any of that today would be to have
one enormous D file with _everything_ in it, including nested
namespaces.