DIP61: redone to do extern(C++,N) syntax
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Mon Apr 28 08:08:28 PDT 2014
On Mon, 28 Apr 2014 11:05:25 -0400, Byron <byron.heads at gmail.com> wrote:
> On Mon, 28 Apr 2014 10:56:24 -0400, Steven Schveighoffer wrote:
>
>>
>> Most definitely no. When the compiler builds b.d, he has no idea it's
>> imported from inside another namespace! We don't want #include-style
>> issues.
>>
>> -Steve
>
> So we would have to include the entire namespace in a single d file
> or is this okay:
>
> a/package.d
> extern(C++, a) {}
> public import a.b;
>
> a/b.d
> extern(C++, a.b) {}
Yes, that is fine.
You could also nest within the same file. But not via an import. In D,
it's important that imports are context-free, it doesn't matter where or
when you import them. This eliminates all sorts of problems that #include
has.
-Steve
More information about the Digitalmars-d
mailing list