RFC in Comparison between Rust, D and Go

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 14 00:06:59 PST 2015


On Saturday, 14 November 2015 at 06:16:15 UTC, Walter Bright 
wrote:
> True, but that doesn't support your assertion that transpiling 
> to C produces better C interop.
>
> Setting aside compatibility with the C preprocessor, I've asked 
> for a single instance where a language that transpiles to C has 
> better C interop than D does.

I'm not sure if it reasonable to set aside the preprocessor, but 
it depends on what you mean by interop:

1. portability

- A language like Nim obviously has a better portability future 
since that is the one of the primary goal of having portable C 
source code.

2. ability to use language X as a C library

- Plenty of tools (specialised languages, like generators for 
parsers etc) do very well in this department, fully supporting 
ability to inline the code across compilers.

- D does ok, for the platforms it integrates with, but you have 
to generate the header files.

3. ability to use C libraries and engines from language X

- D does ok here if the C header files are suitable for 
translation

Compile time does not have to be a big issue, if you have a good 
build system and changes are kept locally in the generated C 
files (smart partitioning of the code into C files). Language 
semantics efficiency is really the primary reason for not 
targeting C, imho.



More information about the Digitalmars-d mailing list