extern(C++, ns)

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 2 21:45:08 PST 2016


On 1/2/2016 9:19 PM, Manu via Digitalmars-d wrote:
> In addition to that rant, extern(C++) seems to fail at forward referencing. Any
> time I have 2 modules that refer to eachother, suddenly the order of everything
> is critical. I can sometimes resolve these problems by moving imports out of the
> global scope, but often it's terminal, and I need to restructure everything in
> awkward and unnatural ways to break the stalemate.
>
> I know I'll just get complaints from people to submit bugs; I have submit lots,
> and in many cases, I've tried to, but they're almost impossible to produce in
> isolation, only when a project gets 'real', ie, big enough that it's realistic
> in scope does it all start to break down. It's really hard to reduce a bug that
> I don't understand, somewhere among a program with 30-ish interconnected
> modules. It's worse when the structure of the project is unnatural, a
> requirement forced by the namespace issue, and everything is already really
> brittle as a result.
>
> The thing is, it almost all comes back to the pseudo-namespaces (sprinkled with
> weird forward referencing issues). Maybe it sounded good at the time, but it
> doesn't work in practice. If that was fixed, then we'd stand on solid ground,
> and it might be possible to reduce bugs and move forward in that environment.

They're not pseudo-namespaces. C++ namespaces in D are scoped namespaces and 
follow all the D scoping and name lookup rules. They are mangled, however, like 
C++ namespace scoped symbols are mangled.

I am not aware of any forward reference issues with C++ namespaces, so without 
an example, I cannot do anything.


More information about the Digitalmars-d mailing list