extern(C++, ns)

Daniel Murphy via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 19 03:50:39 PST 2016


On 19/01/2016 7:54 PM, Walter Bright wrote:
> On 1/19/2016 12:42 AM, Daniel Murphy wrote:
>> So???? Why make extern(C++, namespace) introduce a new symbol? Why not
>> just let
>> it change ONLY mangling and use modules to organize symbols and
>> resolve conflicts?
>
> 1. Because a namespace is a scope, and is expected to act like one.
>

But I don't want a namespace scope, I want to bind to a symbol in a C++ 
namespace.

> 2. So names in different namespaces will not conflict.
>

They won't conflict if they're put in different modules.

> 3. So names in namespaces can be referenced as:
>
>      std.exception
>
> as one would expect.

I think the alternative of just referring to it as stdcpp.exception is 
just fine.  Or better.

>
> As the length of this thread testifies, this has been discussed at
> length already.

My summation of this thread is that very few agree with your design.  I 
recall the same thing of the thread we had before it was introduced. 
I'll admit that it's probably possible to bind to C++ libraries using 
the current feature, clumsy as it is.



More information about the Digitalmars-d mailing list