Specifying C++ symbols in C++ namespaces

Walter Bright newshound2 at digitalmars.com
Wed Apr 2 18:09:43 PDT 2014


On 4/2/2014 3:33 PM, bearophile wrote:
> I suggest to brainstorm the syntax some more time, because someone could be able
> to invent a better syntax.
>
> Some seeds:
>
> extern (C++(nspace)) {
>      int foo();
> }

I considered that, but it fails because:

C++:

     namespace S { namespace T {
         int foo();
         namespace U {
             int foo();
         }
      } }

D:

   extern (C++, S.T) {
       int foo();
       extern (C++, U) {
         int foo();
       }
   }
   foo();  // error, ambiguous, which one?
   S.T.foo(); // S undefined


 > extern (C++) struct nspace {
 >      int foo();
 > }

Fails because a struct as struct and struct as namespace are not distinguishable.



More information about the Digitalmars-d mailing list