DIP61: Add namespaces to D

Daniel Murphy via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 26 23:22:27 PDT 2014


"Walter Bright"  wrote in message news:ljh472$2233$1 at digitalmars.com...

> True. But what D doesn't have is a global namespace. I don't propose one 
> for D, but C++ symbols may appear in the C++ global namespace, or in a C++
> namespace. So using D modules to represent C++ namespaces has a problem.

I think you've misunderstood me.

Modules should be used for the same exact thing they currently are - 
organising symbols.

If you want function 'foo' to be inside module 'bar' you put 'foo' inside 
'bar'.

Once you have the symbol layout you want, you then annotate the declarations 
to specify which C++ namespace they are inside, so the mangling matches.

I am NOT suggesting module name and namespace mangling should be tied 
together.  Use D modules for symbol organisation, and add a simple feature 
for specifying a C++ namespace when required. 



More information about the Digitalmars-d mailing list