On Monday, 9 April 2018 at 18:15:33 UTC, kinke wrote:
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote:
Here's my blog post about my project that allows directly
#including C headers in D*
Certainly interesting. Is there a good reason why you didn't
look into Calypso though? It's restricted to LDC, okay, but its
approach of fusioning C++ and D parts at the AST and LLVM-IR
level seems far more promising to me - no need to translate the
C(++) parts to D and let the underlying D compiler parse &
analyze all that generated code again. And Calypso's C++
support is apparently mature enough to interface with Qt5 (!)...
This whole idea came about because a couple of years ago I was in
a team that was responsible for legacy code written in C which
had no tests. To write tests, we needed both to write the tests
themselves and some fakes/mocks/doubles for the code that we
depended on - essentially a whole operating system. I wasn't
going to write that in C, since life is too short for that.
I wanted to write it in D, and even tried running dstep on one of
the dependency headers we had - to no avail. Manual conversion
was out of the question - too many headers, all them as coupled
together as possible. So I sighed and started writing some C++14.
I hated to admit it, but that mess of headers was only really
usable from C or C++ (Objective C wasn't in the running). I still
feel bad I picked C++ over D, but it was the right choice.
Why not Calypso? It's a hard enough task to convince a team of C
programmers who don't know C++ that C++ was a better choice than
C. It's a herculean task to convince them of D, a language they
know even less and that they've never heard about (the first
question is always "but which companies are using D?").
If you add to all that "No, really, it's ok, there's this project
that forked one of the compilers. No, it's not the reference
compiler. There's just this bit of non-standard syntax to learn
that's neither C nor D", then the chances of convincing any
"normal" engineer are 0.
C++ got popular because it lowered the barrier of adoption to 0.
I want that for D. Because of psychological reasons, I don't
think Calypso is the way to do it, however much it's succeeded
technically. And the whole point of dpp is convince the average
coder and their managers.