extern(C++, ns)

Simen Kjaeraas via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 20 07:32:27 PST 2016


On Wednesday, 20 January 2016 at 12:47:44 UTC, Manu wrote:
>>>> 2. Multiple modules cannot have the same name in D.
>>>
>>>
>>> I'm not sure what situation you're imagining where modules 
>>> would be created with the same names...?
>>>
>>
>> How do you plan to map C++'s standard lib ? One giant hundred 
>> of thousands of line C++ file ?
>
> Surely it would map by file.
>
> #include <vector> -> import stl.vector;
> #include <map> -> import stl.map;
> #include <string> -> import stl.string;
>
> Perhaps 'stl' may be something else, 'std' is an unfortunate 
> conflict with phobos, but this is unique to this case.

I believe deadalnix here meant something like this:

   import stl.vector;
   import mylib.vector;

   Vector a; // Ambiguous: could be from mylib or stl
   stl.Vector b; // Error: no such class stl.Vector
   stl.vector.Vector c; // Works, but requires extra typing

Which with working namespaces might allow case b to work.

--
   Simen


More information about the Digitalmars-d mailing list