On Wednesday, September 12, 2018 3:06:23 PM MDT Manu via Digitalmars-d wrote: > On Tue, 11 Sep 2018 at 20:59, Danni Coy via Digitalmars-d > > <[email protected]> wrote: > > So my understanding is that the main issue with extern(C++,"ns") is > > functions that have different C++ name-spaces overriding each other in > > unexpected ways. How feasible is to simply disallow > > functions/variables/objects/... with the same name but a different "ns" > > being in the same module? > That's natural behaviour. You can't declare the same symbol twice in > the same scope.
And that's really what's so nice about the idea behind extern(C++, "NS"). It's incredibly simple, because it follows _all_ of the normal D semantics. It's just that it then affects how the symbols are mangled so that they link up with the C++ symbols that they're bindings for. So, the whole thing is incredibly easy to reason about. The only downside that I'm aware of is that it makes it harder to put multiple namespaces in the same file, which matters if you're trying to put all of the symbols from a particular header file in a corresponding module. In every other respect, it's simpler - and incredibly easy to reason about. - Jonathan M Davis
