Why is D unpopular?
Walter Bright
newshound2 at digitalmars.com
Sun May 15 17:21:18 UTC 2022
On 5/15/2022 4:55 AM, H. S. Teoh wrote:
> There is, of course, the option of rewriting said C library in D.
In my experience, it is not an option to rewrite working C code into D.
Note that I have successfully converted small and medium C code projects to D.
I've done other translations of programs from one language to another.
1. if you don't have a test suite for the program, a successful conversion
becomes an order of magnitude harder
2. converting a program all at once does not work. It must be done
incrementally, one function at a time
3. even so, when faced with a large, complex project, there's just no business
case for doing a conversion
Even just converting the .h files to D can be a major, rather unpleasant
undertaking. We've put a lot of time into converting the various system .h files
into D for druntime. There's always a risk of a mistake, and we've made them and
the result is bizarre crashes because of ABI mismatches. Hand-checking them is
error-prone, tedious and very boring work.
ImportC makes things so much easier. You can write new D code and hook it up
with your existing C code base. You can get reliable, easy, and accurate access
to .h files. D will happily work with a project that's a patchwork of C and D code.
I.e. it dramatically lowers the barrier to adopting D.
As for languages other than C, they routinely have a C interface. ImportC makes
it easy to hook up with them via the C interface they provide.
More information about the Digitalmars-d
mailing list