DIP61: redone to do extern(C++,N) syntax

Byron via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 28 08:29:53 PDT 2014


On Mon, 28 Apr 2014 11:21:52 -0400, Steven Schveighoffer wrote:

> On Mon, 28 Apr 2014 11:09:38 -0400, Byron <byron.heads at gmail.com> wrote:
> 
>> I am confused now, cross module renaming??
>>
>> I was thinking this:
>>
>> a.d extern(C++, std) {  ... class string ... }
> 
> class string now has two fully-qualified names. a.string, and std.string
> (assuming the current DIP is implemented).
> 
>> b.d import std.string;
>> import cpp = a; // a must be accessed via cpp
> 
> This renames the a *module*, but not the C++ namespace. The C++
> namespace is entirely separate from D's module imports.
> 
> So now, a's string has two names, cpp.string and std.string (still).
> 
>> std.string.... /// okay D version
> 
> Error. Refers both to the std.string module, and the string class within
> the std C++ namespace.
> 
>> cpp.std.string ... /// okay c++ version
> 
> I don't think this would work either. This is a mix of D modules, and
> C++
> namespaces. The DIP does not mention this possibility.
> 
>> string ... /// Okay D version
> 
> I think this may work.
> 
>> cpp.string /// Okay C++ version
> 
> Yes.
> 
> -Steve



Awesome this help me understand your point.  So why does the namespace 
live outside of the module? They have to live in the imported scope?  This 
seems like a big problem to me.  Or I am missing something else?

-Byron


More information about the Digitalmars-d mailing list