extern(C++, ns) is wrong

Danni Coy danni.coy at gmail.com
Fri Sep 14 23:39:12 UTC 2018


On Fri, Sep 14, 2018, 08:47 Manu via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> On Thu, 13 Sep 2018 at 04:46, Danni Coy via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
> >
> > On Thu, Sep 13, 2018 at 5:14 PM Jonathan M Davis via Digitalmars-d <
> digitalmars-d at puremagic.com> wrote:
> >>
> >> The entire point of having extern(C++, "NS") would be to make it so
> that the
> >> _only_ thing that it would affect would be the name mangling. Everything
> >> else is exactly the same behavior as it would be if you had the same
> >> functions as extern(D). It would be up to the programmer to organize
> them
> >> exactly like it is with pure D code. If you think that putting two
> functions
> >> in the same module is too risky, then you can put them in separate
> modules,
> >> but it certainly isn't going to be forced on you unless they actually
> >> conflict. The fact that functions are extern(C++) would have no impact
> on
> >> that whatsoever.
> >
> > Yeah I get all this. It just seems to me that the downsides of
> extern(C++,"ns") from Walter's point of view could be handled by the
> compiler at the cost of a bit of flexibility.
>
> What are the 'downsides' you refer to? And what 'flexibility' is lost?
> The whole point is to gain flexibility. There's definitely no loss of
> flexibility on the table here ;)
>
> > I would like to know how difficult that would be to do and whether that
> would be more acceptable to Walter than what is being being proposed.
>
> You'll need to elaborate. What is being proposed is the simplest
> possible, most plainly obvious,
> let's-not-introduce-unwieldy-edge-cases solution.
>
> Walters named scope should be an unrelated and parallel feature if he
> really wants it.
>

You are suggesting extern(c++,"ns") be a parallel feature to
extern(c++,ns). I am asking how difficult technically would it be to have
your syntax replace Walters but have the compiler check for the situations
where a function from one C++ namespace might shadow one in a different
namespace and emit either a warning or an error.

Honestly I just want to know if going that path will have more or less
friction from Walter.

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20180915/1331280b/attachment.html>


More information about the Digitalmars-d mailing list