Is there any good reason why C++ namespaces are "closed" in D?
Daniel N
no at public.email
Mon Jul 30 12:07:31 UTC 2018
On Monday, 30 July 2018 at 08:44:14 UTC, Walter Bright wrote:
>
> struct S1 { extern(C++, ns) void foo(); } alias foo =
> S1.ns.foo;
> struct S2 { extern(C++, ns) void bar(); } alias bar =
> S2.ns.bar;
>
> Perfect!
>
>
I tried that but it mangles wrong.. it includes "S1" which is not
what you want, so I gave up binding to C++ and used C instead.
pragma(msg, foo.mangleof);
_ZN2S12ns3fooEv
Even if it worked, you'd still see the full name in error
messages and reflection.
It's much harder to undo parts of one complex operation, compared
to composing two simple building blocks. Couldn't we just add a
new parameter to control scope or add a pragma or something?
More information about the Digitalmars-d
mailing list