DIP61: Add namespaces to D

Daniel Murphy via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 28 01:15:49 PDT 2014


"Walter Bright"  wrote in message news:ljjmi6$16nk$1 at digitalmars.com...

> Ok, I saw that, and replied to it earlier this thread.

Yes, but you seemed to miss the point.

> Having a pragma to just add mangling doesn't deal with problems like:
>
>      namespace N { int foo(); }
>      namespace M { int foo(); }
>
>      foo();  // how to specify which one gets called?
>
> I.e. only addressing name mangling does not scale. Need actual scopes, 
> too.

We have MODULES to deal with conflicts.  We do NOT need to add a new type of 
scope to D just for C++ namespaces.

You deal with conflicts the SAME WAY you do with normal symbols - put them 
in different modules.

This is more powerful, because it doesn't force you to match the namespace 
layout in your D code. 



More information about the Digitalmars-d mailing list