On 4/28/2014 12:18 AM, Sergei Nosov wrote:
On Sunday, 27 April 2014 at 19:54:50 UTC, Walter Bright wrote:
http://wiki.dlang.org/DIP61

Quote:

Unlike C++, namespaces in D will be 'closed' meaning that new declarations
cannot be inserted into a namespace after the closing }. C++ Argument
Dependent Lookup (aka "Koenig Lookup") will not be supported.

Do I understand it correctly, that if I have namespace members defined in
different files, like

// a.cpp
namespace ns { int foo(); }
// b.cpp
namespace ns { int bar(); }

I have the only option to put those in a single D file, like

// c.d
extern (C++, ns) { int foo(); int bar(); }

?

That is incorrect. As far as D is concerned, a.ns and b.ns are separate and distinct declarations, even if C++ members of those scopes may mangle to the same name.


And the only way it's more flexible than the hypothetical extern(C++) module ns;
is that you can put several namespaces to a single file?

People who write namespaces in C++ do not pay much attention to what .h files they are in. People writing D imports for such C++ code should not have to re-engineer the layout of the files.

Reply via email to