3 ms·
Given the traction safe languages like rust, C#, typescript/javascript, swift, etc. have, I suspect the time for this is long past -- if there ever was a time.
by jmull 4y ago
Given the traction safe languages like rust, C#, typescript/javascript, swift, etc. have, I suspect the time for this is long past -- if there ever was a time.
I think the problem is a "safe C++" might look a lot like C++ but will have enough fundamental differences to be like a new language from a practical standpoint... devs will have to learn and use new patterns, new tools. Old code will need to be ported and possibly significantly rewritten, since we're talking about memory and threads. At that point, you might find using one of these other safe languages a better option.
- deadbeeves 4y agoGive me C# with RAII and native AOT compilation and I basically don't need to use C++ again. That's close enough to regular C++ that a lot of programs wouldn't need major redesigns.
- jmull 4y agoI think both of those are available in C#.
- deadbeeves 4y agoAOT maybe. RAII definitely not.
- jmull 4y agousing/disposable?
- deadbeeves 4y agousing and/or finally are things you have to get right every time you instantiate the class, and if you get it wrong you no longer get deterministic destruction. Compare with C++, where RAII is the default policy and you have to take extra steps to get dynamic lifetimes.
- JohnFen 4y ago> I think the problem is a "safe C++" might look a lot like C++ but will have enough fundamental differences to be like a new language from a practical standpoint C++ already crossed that threshold many years ago. Today's C++ is essentially a different language from C++ of yore. But it maintains compatibility with the old C++. This is, I think, the central flaw in modern C++. Because of trying to keep that compatibility, so many newer features are bags-on-the-side and the language is bordering on unmanageable. I think it would have been better to have branched off from C++, given it a new name, and waved goodbye to code compatibility. It would have been a better language for it.