On Tue, Feb 27, 2018 at 01:33:18PM -0700, Jonathan M Davis via Digitalmars-d wrote: [...] > The main problem with that is that the fact that as soon as you're > willing to break backwards compatability in C++, then you lose one of > the major benefits of C++ (that the same code compiles pretty much > forever)
Not strictly true. My old C++98 project no longer compiled with the latest g++, because it contained things allowed in C++98 that are no longer allowed in C++17. Some things were relatively simple to fix, but others were quite painful to fix, so I ended up using --std=c++11 as a workaround instead. In the frustrating process of trying to fix things C++17 complains about, I threw in the towel and decided to rewrite it in D instead. [...] > The other problem is that many of C++'s problems come from being a > superset of C, which is also a huge strength, and it would be a pretty > huge blow to C++ if it couldn't just #include C code and use it as if > it were C++. Not strictly true either. Most modern C header files come wrapped with: #ifdef __cplusplus extern "C" { #endif ... #ifdef __cplusplus } #endif __cplusplus because without that, a lot of C headers actually would *not* compile. Granted, though, this is a lot easier than having to write JNI wrappers or (carefully!) translate C headers into D. It would be nice if you could actually just copy-n-paste a C header into an extern(C) block in D and have it Just Work(tm), but practically all C headers are dependent on macros one way or another that it would require including an entire C processor inside the D compiler, which is not exactly an inviting proposition. > To truly fix C++ while retaining many of its strengths would require > fixing C as well, and that's not happening. [...] Actually, C and C++ have already somewhat diverged. The C subset of C++ is an actually older dialect of C, and no longer 100% compatible with modern C. Though it's true that it's still 95% compatible, which is Good Enough(tm) for most purposes. T -- A program should be written to model the concepts of the task it performs rather than the physical world or a process because this maximizes the potential for it to be applied to tasks that are conceptually similar and, more important, to tasks that have not yet been conceived. -- Michael B. Allen