4 ms·
I think someone should fork a new language from C++ and remove all the stuff that could be deprecated. I don't mean to make a new language like Zig or rust or
by jokoon 5y ago
I think someone should fork a new language from C++ and remove all the stuff that could be deprecated.
I don't mean to make a new language like Zig or rust or nim. I mean just a "saner" C++ without all the backward compatibility that is holding back the language.
- skocznymroczny 5y agoJust use D. D is a saner C++.
- grumpyprole 5y agoIsn't part of the problem that no one can agree on the best subset? Compilers could provide pragmas and switches to enable projects to define their own language subset.
- MaxBarraclough 5y agoA fair point, but the major C++ compilers don't make much effort in letting you define a subset to permit. For contrast, the Ada language (which is larger than C but smaller than C++) takes this idea quite seriously. There are various 'well known' subsets of Ada with interesting properties and tooling. These subsets are called profiles. There's SPARK, a very minimalist subset tailored for formal verification, and Ravenscar, for concurrent hard real-time systems. Profile compliance is checked by the compiler itself. (If I understand correctly, the profiles are defined using Ada's rough equivalent of #pragma in C and C++.) In the C and C++ worlds there are subsets like Google's C++ style guide, LLVM's C++ style guide, MISRA C, and MISRA C++, but their tools (i.e. static analysis tools to check for compliance) are generally separate from the compiler, for what that's worth.
- XorNot 5y agoThis would argue in favor of several languages. Which would be fine - maybe we need several, maybe one would clearly win out.
- shakna 5y agoBetterC [0] is that, for me. It's a subset of D, that only relies on the C Standard Library. So all the features and syntax of D that is sane, without any of the extras that people find go too far beyond a system's language. You still get all the compile-time constructions, RAII, memory protection, lambdas, modules and so on. [0] https://dlang.org/spec/betterc.html https://dlang.org/spec/betterc.html
- spoiler 5y agoThis idea reminds me of the Go+ language (https://goplus.org/ https://goplus.org/), which is kind of what you're proposing. But instead of reducing the language, they just "added less"! I think they were inspired by C++, but decided one "plus" to the language was enough. Maybe the "pluses" add exponential complexity, and C++ hasn't reached the end of its second plus stage yet. /jk
- speedgoose 5y agoBut if you break backwards compatibility, why would such a language be interesting compared to the other languages you mentioned ?
- OtomotO 5y agoI guess familiar syntax and a flatter learning curve. (note: I am not a C++ dev, so this is just my assumption/derivation)
- jokoon 5y agoWell, there are almost no good enough alternative to C++, in my view. Rust is hard to learn, Zig and other change the syntax way too much. Also, it would not be difficult to link against existing C++ libraries, or at least to wrap them using extern C. The goal would be a language that has the good things that C++ has, without the cruft: long compile times, edge cases, etc. It's pretty amazing how the C++ ISO group managed to add things without breaking backward compatibility, so imagine if they agree to explicitly deprecate thing. I just hope that one day, there will be a split between "old C++", that will still be kept compatible to not break old codebases, and "new modern C++". I'm not an expert, but I think it might be doable, maybe with some compile flags? I don't really think it would break the ABI or break binary compatibility between old and new C++. I don't know.
- nemothekid 5y agoI don't understand the argument that Rust is hard to learn, unless you also mean C++ is hard to learn. If you come from C++, I don't believe the borrow checker should be that hard to learn; after all it's kind of just an extension of RAII semantics. It's far more straight concept than forward than C++ templates.
- xigoi 5y agoNew syntax is the easiest part of learning a language.
- speedgoose 5y agoI think Rust is much easier to learn than C++. The borrow checker is hell but once you understand that it’s very smooth.
- FreelanceX 5y agoWhy create a new language if you only remove things? You should be able to achieve the same with a strict linter.
- tsimionescu 5y agoI think that would clean up C++ far less than you think. Most of C++'s problems come from it trying to offer 0-cost abstractions, at any cost to language complexity.