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

Regan Heath via Digitalmars-d digitalmars-d at puremagic.com
Thu May 1 03:03:21 PDT 2014


On Wed, 30 Apr 2014 20:56:15 +0100, Timon Gehr <timon.gehr at gmx.ch> wrote:
> If this is a problem, I guess the most obvious alternatives are to:
>
> 1. Get rid of namespace scopes. Require workarounds in the case of  
> conflicting definitions in different namespaces in the same file. (Eg.  
> use a mixin template.) I'd presume this would not happen often.
>
> 2. Give the global C++ namespace a distinctive name and put all other  
> C++ namespaces below it. This way fully qualified name lookup will be  
> reliable.

3. Use the C++ namespace for mangling, but not lookup.  C++ symbols will  
belong in the module they are imported into, and be treated exactly the  
same as a D symbol, e.g.

module a;
extern(C++, std) ..string..

module b;
extern(C++, std) ..string..

module c;
import a;
import b;

void main() { .. string .. }   // error could be a.string or b.string
void main() { .. a.string .. } // resolved

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list