extern(C++, NS)

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 29 23:45:57 PST 2015


On 11/29/2015 8:31 PM, deadalnix wrote:
> On Sunday, 29 November 2015 at 18:29:14 UTC, Walter Bright wrote:
>> On 11/28/2015 8:40 PM, Manu via Digitalmars-d wrote:
>>> The trouble mostly appears in this situation:
>>>
>>> file1.d
>>>    extern(C++, NS) struct X;
>>>
>>> file2.d
>>>    extern(C++, NS) struct Y;
>>>
>>> file3.d
>>>    import file1, file2;
>>>    X x; // nope
>>>    Y y; // nope
>>>    NS.X x; // NS has multiple definitions...
>>>    NS.Y y; // NS has multiple definitions...
>>
>>     file1.NS.X x;
>>     file2.NS.Y y;
>>
>> works.
>
> Why not produce something similar to an overload set for C++ namespace ? An
> error needs to be issued only if X or Y is duplicated, otherwise, this is fine.

Because I'd rather have symbol table lookups done in a consistent manner, rather 
than special casing it everywhere. The above behavior is completely consistent 
with how everything else works, because it uses the exact same code.


More information about the Digitalmars-d mailing list