On 4/26/14, 12:27 PM, Daniel Murphy wrote:
"Walter Bright" wrote in message news:[email protected]...
Having a pragma to just add mangling doesn't deal with problems like:
namespace N { int foo(); }
namespace M { int foo(); }
foo(); // how to specify which one gets called?
I.e. only addressing name mangling does not scale. Need actual scopes,
too.
We already have a feature to manage conflicts and organisation in D code
- modules! There is no need to add namespaces to do that, and if that's
really what you want it belongs in a completely different discussion.
The thing we can't (easily) do is mangle C++ namespaces, so a feature
that only affects mangling is perfect.
i.e. We don't need namespaces in D, because modules cover that. We only
need namespace mangling.
Yah, that's why something along the lines of
extern(C++) module facebook.folly;
comes to mind. Following such a module declaration, stuff inside of it
is considered inside C++ namespace facebook::folly.
The disadvantage of this is that it forces one .di file per namespace,
whereas in C++ people frequently use different namespaces within the
same file.
Andrei