DIP61: redone to do extern(C++,N) syntax

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 29 13:33:09 PDT 2014


On 4/29/2014 1:23 PM, "Ola Fosheim Grøstad" 
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> On Tuesday, 29 April 2014 at 19:48:36 UTC, Walter Bright wrote:
>> I'd do your example as:
>>
>> vec.d:
>> extern(C++,veclib){ struct … vec4 …; }
>>
>> framework1.d:
>> import vec;
>> extern(C++,physics){ vec4 f(vec4 …) … }
>>
>> framework2.d:
>> import vec;
>> extern(C++,graphics){ void g(vec4 …) … }
>
> Yes, but that requires the authors of framework1 and framework2 to cooperate.

Not really. It is reasonable to expect that when Framework1 and Framework2 each 
import 4th party Vec, that they do it with an import rather than inlining Vec's 
declarations.


> Which is why you with this DIP will end up with people being better off by using
> pure C++ rather than mixed D/C++ from different sources.
>
> With "graphics::g(physics::f(…))" this would not have been an issue.

Having an alternative lookup method is a large increase in language complexity.



More information about the Digitalmars-d mailing list