6 ms·
It feels like the C++ committee should be working on a "C++ Safe Edition 2025" as an opinionated and radical overhaul of the language. Absent something is radic
by mjburgess 4y ago
It feels like the C++ committee should be working on a "C++ Safe Edition 2025" as an opinionated and radical overhaul of the language. Absent something is radical, govs & industry leaders are going to continue to call for the death of C++.
Given work on Circle (, Carbon, etc.) -- a "radically opinionated" Edition of C++ as a fork in the standard seems required (where Edition = Fork).
Incrementalism towards a "more polished" C++ won't be enough; not least due to branding.
- eej71 4y agoI think you’d be hard pressed to name another case where there that kind of breaking change was very successful. I’d highlight the python 2->3 change as not something to replicate. Same with what has happened to Perl.
- deleted 4y ago[deleted]
- mejutoco 4y agoJs -> Typescript? As an opinionated js, definitely. Probably also incremental, in a way.
- creata 4y agoI don't know why (maybe someone can explain?) but frontend developers seem very happy to frequently move between languages and frameworks. I don't think that's true for the places where C++ is popular.
- fredrikholm 4y agoC++ is (primarily) used where there aren't any other viable alternatives (other than C). Browser frontends (in general) set not such demands (size, memory, speed guarantees) and its bloat more often comes from things outside of code (images, videos, trackers), so there's freedom to use whatever floats ones boat. Combined with the ever increasing demands on app complexity, frameworks and born left and right. The strong movement into functional programming in this area has also led the way for other languages (SMLs, Lisps) that better fit that model.
- zabzonk 4y agoyou would be wrong - i used to be a c++ developer working in finance, and I and my colleagues routinely used at least half a dozen other languages, and frameworks.
- eru 4y agoThe Python 2 to 3 transition took a while, but I'd say it was successful in the end, wasn't it?
- oblio 4y agoThere are some arguments to be made they didn't break enough. For example: - I think they bungled the Unicode transition by being too dogmatic and it took them a few point releases to include some quality of life improvements for migration that really allowed legacy libraries to transition - the GIL dependency didn't go away - typing was added later Python 3 would have been a huge jump with those changes. Instead, Python 3.0 was very interesting but a major annoyance for limited benefits to 99% of Python app devs.
- eru 4y agoI agree with your points. There's some serious work going on with the GIL these days. And also about immutability and reducing reference counting. > [...] it took them a few point releases to include some quality of life improvements for migration that really allowed legacy libraries to transition I wouldn't hold that against the transition too much. No one gets everything right from the start. About typing: owing to Python's culture, I don't think mainstream Python will be statically typed by default (or even obligatorily) anytime soon.
- deadbeeves 4y agoThat would imply that it actually finished, which is not obvious to me. The last time I found Python 2 code must have been a few months ago, and I'm not a regular Python user. And that's kind of the problem: old code never just goes away. It lingers until you try to compile it and it fails.
- eru 4y agoIsn't that the same with old versions of eg C++?
- 4y ago
- eru 4y agoWhy do you think C++ committee would be the best people to do the radical and opinionated overhaul? And given that, if we have people working on Rust, Circle, Carbon etc, what would your idea actually change?
- mjburgess 4y agoon the view that their interests are to grow & preserve c++ competitors will compete
- ModernMech 4y agoThis is my feeling. C++ doesn’t need to be anything more than it is. There’s no void a supposed safe C++ needs to fill; that’s what Rust is doing.
- deadbeeves 4y agoNah, I disagree. Rust fills the void of "natively compiled safe language". If you need something that's "like C++" (whatever that means to you) but safe, Rust may not work for you. And it's certainly not true that no one needs a safe C++. If someone right now starts a new project in C++ and not Rust it's because that's what they think is best all things considered, not because they don't need memory safety.
- eru 4y ago> If someone right now starts a new project in C++ and not Rust it's because that's what they think is best all things considered, not because they don't need memory safety. I guess most reasons are 'use what we know well', and 'use what we have tooling for'. But there's probably some others.
- lenkite 4y agoAnd also a common reason: use the language with features that Rust does not have.
- geokon 4y agoThey had something like this. It was called Core Guidelines. I think it was a bit of a misnomer b/c it sounded like some glorified style guide. But it was actually a set of tools and helpers/wrappers that effectively made it impossible to write a lot of unsafe pre-modern C++. For whatever reason it's never really caught on, though it looks like it's still being worked on: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines In principle it seems to kinda strikes the right balance where the language is narrowed - it's still all valid C++ (not an entirely new thing), but not all C++ is valid under the Core Guidelines I'll be honest - I never tried it myself so I don't know it's deficiencies. Maybe someone who's given it a good try could weight in
- kllrnohj 4y agoI reference the cpp core guidelines all the time. It's not dead at all, things like clang-tidy make references to it constantly for rationale behind recommendations. There's only a few things I'm not a fan of, mostly around mutable out parameters (I prefer pointers not refs to make it clear at the call site it's a potential mutation)
- geokon 4y agoreference as in a style-guide? Or are you actually using the guidelines support library with things like gsl::index ? I've never seen it used in the wild
- kllrnohj 4y agoI don't use the gsl, no, but I do use linters (like clang-tidy) that enforce a decent chunk of the guide. And reference like a style guide (or any documentation really), yes.
- simplotek 4y ago> but I do use linters (like clang-tidy) that enforce a decent chunk of the guide. And reference like a style guide (or any documentation really), yes. That's my experience as well. Clang-tidy, clang-format, cppcheck and Core Guidelines. I don't recall the last project I've worked that didn't used that combo.
- wyldfire 4y agoIf you ask me, the GSL [1] alone is a fairly radical departure from C++ that delivers a lot of safety. I don't know if it's gotten much popularity, though. Probably because it introduces a similar disruption like you might find from a brand new programming language. [1] https://github.com/microsoft/GSL https://github.com/microsoft/GSL
- amelius 4y agoWe should have some Large Language Model that translates C++ to idiomatic human-readable Rust, using correctness-preserving transformations of course.
- jmull 4y agoGiven 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.
- 4y ago
- xjay 4y agoHerb Sutter is working on a standalone, second syntax for C++ called "Cpp2" [1] to "reduce complexity 10x, increase safety 50x, improve toolability 10x, evolve more freely for another 30 years". [2] Compiler Explorer lists it under Cpp2-cppfront. [3] [1] https://herbsutter.com/2022/12/31/cpp2-and-cppfront-year-end-mini-update/ https://herbsutter.com/2022/12/31/cpp2-and-cppfront-year-end... [2] https://www.youtube.com/watch?v=ELeZAKCN4tY&t=321s https://www.youtube.com/watch?v=ELeZAKCN4tY&t=321s [3] https://godbolt.org/ https://godbolt.org/
- grok22 4y agoBut isn't such a language already there? It's called the D Programming Language [1]. Sorry a bit tongue-in-cheek, but I'm getting tired of all these 'even-more-awesome' new programming language variants of C++. [1] https://dlang.org/ https://dlang.org/
- RcouF1uZ4gsC 4y agoD could have been that. Back when it was released, D was so far ahead of C++98. However, D decided to go with garbage collection which kept it from being a replacement for C++. In addition, the D garbage collector never received the massive investment that Java’s garbage collector has received.
- gavinray 4y agoThe garbage collection is an optional feature you can disable though There's a lot of "@nogc" D code out there. Audio FX plugins that do realtime DSP and game/graphics stuff come to mind. I'd rather have the language give me a choice because it's very convenient to have. You'd be surprised how performant even GC'ed code in D's can be.
- lenkite 4y ago> The garbage collection is an optional feature you can disable though Not if you wish to use the standard library though right ?