On Monday, 12 February 2018 at 03:17:20 UTC, Walter Bright wrote:
On 2/11/2018 6:26 PM, Elie Morisse wrote:
Wow, you converted DMC++'s front-end to D?

Yes, it's just frustrating for me to work on C++ code anymore. :-)

To chime in on that, Calypso i.e the LDC+Clang equivalent of what you described isn't dead (it just revived a few weeks ago from a long slumber) and it should be possible to make a smaller codegen-less version for DMD that only depends on a few Clang and LLVM support libraries. Another possibility..

Good ideas! Some things to consider:

1. I'd like this to be pluggable, so that different compilers can be used without being disruptive to dmd.

2. DMC++ is not only a C compiler, but a C++ compiler. The C++ compiler, though, is stuck on C++98 and is unlikely to see much improvement on that.

3. BetterC is called BetterC and not BetterC++ because D's C++ interop is more fragile than the C interop. I felt it better to nail the C end first.

4. It certainly would be nice to be able to insert C++ headers, too, but I'd expect more problems (!).

5. C is stuck at C99. Being a fixed target makes it more tractable. Supporting C++ means constant revisions and high support costs.

C is currently at [C11]. Granted not many projects switched to it, as its changes were not as useful as C99. All the things added to C11 are features that try to extend the language in directions where it's better to switch to a better language like D (-betterC).

6. Using DMC++ as a front end would add somewhat less than a megabyte (half?) to the binary size of dmd. I have no idea what Calypso or other solutions would add. If they are large, they may only make sense as a separate executable as a filter.

[C11]: https://en.wikipedia.org/wiki/C11_%28C_standard_revision%29

Reply via email to