On Mon, 28 Apr 2014 09:24:59 -0400, Steven Schveighoffer
<[email protected]> wrote:
On Sat, 26 Apr 2014 05:31:51 -0400, Walter Bright
<[email protected]> wrote:
http://wiki.dlang.org/DIP61
Best practices in C++ code increasingly means putting functions and
declarations in namespaces. Currently, there is no support in D to call
C++ functions in namespaces. The primary issue is that the name
mangling doesn't match. Need a simple and straightforward method of
indicating namespaces.
There have been many proposals earlier:
http://forum.dlang.org/post/[email protected]
but it seems to me that the simplest, most straightforward approach
would be better.
As more and more people are attempting to call C++ libraries from D,
this is getting to be a more and more important issue.
Just reviewed the DIP, I've been following the discussion.
One possible issue, to which I think I know the answer but it should be
explicit, is conflicting top-level functions and namespace functions:
extern(C++, N) { void foo();}
extern(C++) void foo();
Clearly, calling N.foo would be unambiguous, but there is no namespace
to qualify the global foo. I'm assuming .foo() would work, but this
should be explicit in the DIP. Right now it says use the namespace to
qualify ambiguous calls.
I think the proposal looks good to me.
I have to rescind this endorsement. I think there is an issue with name
lookup. I will explain in a reply to the other thread.
-Steve