6 ms·
You're right, but dammit, I wish you weren't. A world in which we can evolve existing large C++ codebases gradually towards safety instead of having to RRiR is
by quotemstr 1y ago
You're right, but dammit, I wish you weren't. A world in which we can evolve existing large C++ codebases gradually towards safety instead of having to RRiR is a better world.
There are lots of cool innovations C++ made that will just disappear from the Earth, forever, if C++ can't be made memory safe in the same sense Rust is. I mean, Rust doesn't even support template specialization.
I don't think it's too late for someone to fork both C++ and Clang and make something that's actually a good synthesis of the old and the new.
But yeah, the most likely future is one on which C++ goes the way of Fortran (which still gets regular updates, however irrelevant) and the energy goes into Rust. But I like to rage, rage, against the dying of the type based metaprogramming.
- tialaramex 1y agoWell like you said, Fortran didn't actually go anywhere. Fortan 77 is a terrible programming language, but you can't seriously claim it "disappeared from the Earth". Not that long ago tsoding was like "I should learn Fortran" and wrote a bunch of Fortran. Obviously from his perspective some things about Fortran are awful because it's very old, but it wasn't somehow impossible to do. There are a few really amazing things which have been achieved in C++ like fmt, a compile time checked, userspace library for arbitrarily formatting variadic generic parameters. That's like man on the moon stuff, genuinely impressive. Mostly though C++ is a garbage fire and so while it's important to learn about it and from it we should not keep doing that.
- Yoric 1y ago> There are a few really amazing things which have been achieved in C++ like fmt, a compile time checked, userspace library for arbitrarily formatting variadic generic parameters. Anecdotal, but that's hardly unique to C++. So even if C++ were to disappear overnight (which we all agree won't happen), this wouldn't be a burning-library-of-Alexandria moment.
- tialaramex 1y agoWell. What other examples of this feat are you thinking of? To me the things which come to mind are either compiler magic (e.g. C printf) or they rely on RTTI (e.g. Odin and similar C-like languages) and neither of those is what fmt does, they're "cheating" in some sense that actually matters.
- int_19h 1y agohttps://doc.rust-lang.org/std/macro.format.html https://doc.rust-lang.org/std/macro.format.html https://zig.guide/standard-library/formatting/ https://zig.guide/standard-library/formatting/
- notmywalrus 1y agoRust is an example of "compiler magic" in this case. You're right about Zig, and reading the source [1] I'm still kind of impressed how unified they made comptime / runtime. [1]: https://github.com/ziglang/zig/blob/32a1aabff78234b428234189ee1093fb65f85fa3/lib/std/Io/Writer.zig#L536 https://github.com/ziglang/zig/blob/32a1aabff78234b428234189...
- int_19h 1y ago"Compiler magic" is generally used to describe things that are built into the compiler; I don't see why macros would qualify. And if they do, then why wouldn't template metaprogramming?
- Yoric 1y agoI co-implemented this in OCaml ~20 years ago, using no compiler magic (it did use a macro). Pretty sure that I've seen the equivalent in Haskell, too, and in variants of Scheme. Zig has it, too. And while, as you mention, the Rust implementation does use compiler magic, I'm pretty sure that it could be implemented as a macro, just more slowly. etc.
- Yoric 1y ago(sorry, it wasn't you who mentioned it, but it was a good remark nevertheless :) )
- pklausler 1y agoJudging Fortran by looking at Fortran 77 is preposterously uninformative.
- worthless-trash 1y agoWhat should we be looking at ?
- slavik81 1y agoIf we're judging the state of Fortran in 2025, we should probably be discussing Fortran 2018 or Fortran 2023.
- BoxFour 1y ago> I don't think it's too late for someone to fork both C++ and Clang and make something that's actually a good synthesis of the old and the new. People have tried variants of this already: Carbon, for example. I don’t think anyone outside of Google uses it, though, and even within Google I suspect it’s dwarfed by regular C++. I don’t think C++ will become irrelevant for a long time. Recent standards have added some cool new features (like std::expected), and personally I feel like the language is better than ever (a biased opinion obviously). Memory management is still a huge elephant in the room, but I don’t think it’s becoming irrelevant.
- pjmlp 1y agoCarbon is still being designed, and their goal is to migrate existing code, for Google purposes. They are quite open everyone else should use a managed language or Rust.
- Yoric 1y agoFWIW, Rust doesn't have specialization yet because they're really hard to get right without introducing new undefined behaviors. This doesn't mean that it's not possible to achieve a safe subset of C++ that supports template specialization, but it suggests that we aren't going to see it any time soon.
- fooker 1y ago> fork both C++ and Clang Great! What are you waiting for? If you try to answer that question, you'll also find why other similar projects are not finding much traction yet.