extern(C++, ns) is wrong

Manu turkeyman at gmail.com
Tue Sep 11 02:26:45 UTC 2018


On Mon, 10 Sep 2018 at 13:40, Carl Sturtivant via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Wednesday, 5 September 2018 at 13:53:15 UTC, Jonathan M Davis
> wrote:
> > On Wednesday, September 5, 2018 7:03:26 AM MDT Nicholas Wilson
> > via Digitalmars-d wrote:
> >> [...]
> >
> > Based on everything Walter said in the previous thread, it
> > honestly seems to me to be primarily like he just can't give up
> > on the idea that D has to worry about modeling C++ namespaces.
> > Pretty much all of the extra complications that come from the
> > current approach stem from insisting on modeling namespaces in
> > D instead of just treating the namespace as part of the
> > information that you give to the compiler to indicate what the
> > symbol in D is supposed to correspond to in C++ when the
> > compiler goes to mangle it.
> >
> > [...]
>
> I wholeheartedly agree. C++ namespaces are a C++ language idea
> that D has discarded in favor of much simpler facilities.
> Injecting that <expletive-deleted> back into D when linking to
> C++ is polluting D with needless complexity at odds with that
> gain in simplicity. The name collision problem with two
> namespaces containing the same name can be resolved with much
> simpler facilities. For example, at the point of the extern
> declaration, the name of the linked entity could be provided as
> an optional third parameter so that the name in D could be
> different. I'm sure many other simple schemes could be invented,
> more consistent with D's approach.

This is a problem that doesn't need a solution. Just use modules; this
is precisely what they're for.
I, for one, have faith in the module design.


More information about the Digitalmars-d mailing list