D as an extension language for C

Walter Bright newshound2 at digitalmars.com
Sun May 14 23:56:55 UTC 2023


On 5/14/2023 1:21 AM, IGotD- wrote:
> I thought it was C++ you wanted to leverage.

I knew back then the impracticality of importing C++ code.


> You keep mention on this forum that you keep on hitting corner cases with 
> importC which s expected. C is old and there many quirks, non-standard and 
> compiler specific code out there. I would still gone the converter route as it 
> would instead translate the .h file to native D which you then can use natively 
> within D.

We've had 3 converters so far.

> For example you haven't enabled C macros to be used within D, with a 
> converter you could have converted the macro to D code (mixin?). I think that 
> would have scaled better than trying to retrofit a C compiler into D compiler. 

There are a number of C features which do not translate into D. But with ImportC 
I can make them work seamlessly.

 > Also why should C be a first class citizen and not C++, Rust etc.

C is the lingua franka, not C++ or Rust.

 > Since there
 > are plenty of languages out there a converter project for each language is more
 > convenient.

I can only do so much.


> I'm a bit afraid that importC will be a feature that needs constant patching and 
> consume time.

C changes a lot slower than other languages.



More information about the Digitalmars-d mailing list