13 ms·
Moving from Rust to C++
- deleted 4y ago[deleted]
- rokob 4y agoGot me for a minute. Nice.
- xyzzy4747 4y agoApril Fool’s joke? Otherwise, this is definitely a first.
- danielvaughn 4y agoIt must be an april fools joke
- adamnemecek 4y agoDefinitely Raph is very much into Rust.
- influx 4y agoGiven I have never heard of this person, the joke isn’t very funny. These internet April fools jokes are so tiring.
- PaulDavisThe1st 4y agoOne of the most important people in the later development of X Window, also worked on other 2D drawing APIs. [ EDIT: I was wrong about X Window. Take back all the karma! ]
- raphlinus 4y agoI was only tangentially involved in X, but was active in a lot of related projects (some Gtk infrastructure, Ghostscript, the seeds of what became Inkscape), and now work on GPU-accelerated font rendering. I also played a central role in getting Rust adopted at Google, and now one of my passions is advancing the Rust GUI space, as I feel like that has enormous potential.
- eliasmacpherson 4y agoThat too, I had no idea, am so impressed. I use your music-synthesizer-for-android code nearly as much as FM7. :-)
- PaulDavisThe1st 4y agoWhoa. Now why did I think that. Sorry for the mis-attribution. But also, you really should move to C++, for all the reasons you listed!
- nasretdinov 4y agoHonestly there were so many small signs that you work at Google, e.g. the fact that you used Bazel and Blaze interchangeably or referring to Carbon as a C++ replacement, although I guess both things are kind of public knowledge anyway...
- andrepd 4y agoI've found it quite funny actually.
- peterfirefly 4y agoIf you haven't heard of him, the joke's on you. Maybe. In any case, his work is worth looking into. He has done interesting work in font creation, font building primitives, rasterization, 2D drawing, and resistant social network graphs (which turns out to be more or less equivalent to the Old Sk00l Google Juice system). He was recently instrumental in performing a wonderful experiment in editor building -- wonderful because of the way it failed. It was something that one would think would work, but somehow it didn't. It's always interesting when intelligent and well-informed people are wrong about something. Perhaps there was too much Design and too little boring boiler plate. https://levien.com/ https://levien.com/ https://levien.com/type/myfonts/inconsolata.html https://levien.com/type/myfonts/inconsolata.html https://levien.com/phd/phd.html https://levien.com/phd/phd.html https://en.wikipedia.org/wiki/Sodipodi https://en.wikipedia.org/wiki/Sodipodi https://en.wikipedia.org/wiki/Advogato https://en.wikipedia.org/wiki/Advogato https://raphlinus.github.io/xi/2020/06/27/xi-retrospective.html https://raphlinus.github.io/xi/2020/06/27/xi-retrospective.h...
- amelius 4y ago> He was recently instrumental in performing a wonderful experiment in editor building -- wonderful because of the way it failed. They clearly should have migrated to C++ sooner :)
- peterfirefly 4y agoYes, C++ does have fast JSON parsers.
- hu3 4y agoSorry but I didn't know the author either. And with due respect, none of his work is directly aplicable in the majority of software development roles I have been involved with, directly and indirectly. And that's fine. There's nothing to be ashamed of nor it is something to shame someone for. The world is large and specialized. If we were speaking about Linus or Bill Gates then perhaps it would be a surprise for some tech savy person to not know them.
- ndesaulniers 4y agoTell us you write C++ without telling us you write C++. I write C++; the post was hilarious. You're just being salty.
- bot347851834 4y agoI wonder what's the consensus on HN about April Fools blog posts like this one. It's probably a cultural thing but I really feel like it's a waste of time, both for the readers and the writer. I don't want to be overly negative because of course they can be a way of publicizing cool things (in this case an open source library). It's just that every April 1st I open a lot of links only to be disappointed that their content is a joke just without it really being funny.
- yodsanklai 4y agoI think it's pretty good April Fool's joke actually.
- ape4 4y agoI didn't mind it. I almost fell for it until I read "First, I consider myself a good enough programmer that I can avoid writing code with safety problems". oh, its April 1
- 2h 4y agoas you said, its annoying and a complete waste of time. Its essentially someone lying to their audience. As someone trying to build a reputation or a following, how do you do that?
- wdpk 4y agosounds like desperation to become relevant
- raphlinus 4y agoI think you nailed it. I wake up each morning consumed with anxiety, thinking to myself, "how do I become relevant?" Clearly, having shipped advanced multilingual typesetting capabilities to billions of users didn't do it, nor developing high performance GPU rendering algorithms, nor having made a popular programming font. But posting a language comparison to Hacker News, that should put me on the map.
- rwaksmunski 4y agoDon't let the haters get to you. You and your work are awesome.
- pornel 4y agoFace it, your work will never be as immortal as autotools. You also bet on wrong languages. M4 is battle-tested, stood the test of time, and is much more stable.
- mwcampbell 4y agoI wouldn't be surprised if he worked with autotools and m4 when working on, for example, an early version of GNOME's librsvg. Seriously, I was looking at a librsvg header file a couple months ago and was surprised to find his name.
- raphlinus 4y agoYou are right, and that is an excellent way to state my goals: I hope to create systems that have as much lasting impact as autotools.
- bonzini 4y agoThat said, for those of us that don't have the luxury of working only in Rust, the cargo monoculture is a problem. Or more precisely, as a result of that monoculture there is a single implementation of build.rs and it cannot interoperate with anything else. If cargo could optionally generate a build.ninja file or some JSON with the command it runs, it would be so much easier.
- vlovich123 4y agoGood job Raph. You absolutely got me.
- deleted 4y ago[deleted]
- cod1r 4y agoI didn't realize it was an april fools joke until i read the reddit comments T_T
- jchw 4y ago> Here, it is clear that Rust is held back by its commitment to not break existing code (enacted by the edition mechanism), while C++ is free to implement backwards compatibility breaking changes in each new version. This is well done.
- mr_00ff00 4y agoMaybe I am being dumb, but isn’t the opposite true? Or is that the joke? I can’t tell if the joke is that backwards compatibility is good or whether it’s that the languages are switched there
- zone411 4y agoRight, it's switched around compared to the rest of the post.
- wongarsu 4y agoThat's partially the joke. The other part is in the preceding sentences: > C++20 brings us modules, an innovative new feature, and one I’m looking forward to actually being implemented fairly soon. Looking forward, C++26 will likely have stackful coroutines, the ability to embed binary file contents to initialize arrays, a safe range-based for loop, and many other goodies. > By comparison, the pace of innovation in Rust has become more sedate. The reason C++ is getting all these new features while Rust isn't is not Rust being held back by backwards compatibility, but that Rust has all those features already. So he's basically saying: C++ is breaking backwards comparability to (eventually, years after the spec was published) bring us features that Rust already has.
- raphlinus 4y agoI'll explain the joke, as it's subtle. Rust indeed has an explicitly stated backwards compatibility guarantee, which limits evolution of the language. One example of that is Range not being Copy because of some decisions taken early on; most people would agree that this was a mistake. There is an "edition" mechanism that allows some evolution, for example adding new keywords, but it can't solve everything. C++, by contrast, has a tradition of maintaining backwards compatibility, but it is not enforced systematically, and in practice migrating to newer versions of C++ can be a painful process. Thus, in many application domains (especially embedded), developers are stuck on very old versions of the language. There's also a very sticky issue of whether binary (ABI) compatibility is guaranteed. There's nothing in the standards process that guarantees this, but there has been huge resistance to proposed improvements that break ABI. This was a particular sticking point for Google[1], as it affects unique_ptr, making it not so much the zero cost abstraction as originally hoped. Language evolution is a difficult problem, and there is no magic, obviously correct answer to it. But I think Rust has a good, pragmatic approach, and the flaws such as Range are a very small part of the overall language surface area. Modules are a particularly disruptive to the ecosystem. It's taking a long time to get them properly implemented in C++, and it also requires fairly major changes to code bases, build systems, and other infrastructure to migrate to them. By contrast, Rust has had a decent module system since 1.0 (with various tweaks and changes through the edition mechanism). Edit: and as 'wongarsu says in a sibling comment, another part of the joke is that Rust doesn't need as much evolution as C++, as it already has a lot of the advantages such as a working module system. [1]: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2028r0.pdf https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p20...
- Herval_freire 4y ago[flagged]
- tester756 4y agoWhile having well designed language and libraries is really useful and handy then using keywords/APIs that start with "__" is even better! it significantly increases readability! Nested macros are the most powerful feature and very fun to debug!
- skywal_l 4y agoNice april fools, but not as good as the "Really" proposal from last year: https://www.kdab.com/cpp23-will-be-really-awesome/ https://www.kdab.com/cpp23-will-be-really-awesome/
- layer8 4y agoNice, though the enum part wasn’t convincing, because separate compilation can still lead to not all cases being covered. Or rather, an enum type in C and C++ is really an integer type plus some associated constants, and the values that can be stored in that type aren’t restricted to the constants.
- mastax 4y agoAw man, this got me good.
- hsjqllzlfkf 4y ago[dead]
- SCdF 4y agoIn the spirit of "knowing enough to be dangerous", I know just enough of who Raph is and the languages discussed to know that he knows what he's talking about, but not enough to realise this is satire, and too hungover to know what the date is. Glad I came back through HN to read the comments, because without that I would have left that blog with a very different opinion.
- your_challenger 4y agoI was really confused for a solid second there. The points the author raises are what Rust tries to solve 1) A simpler build system 2) Safety guarantee by the compiler and not the programmer's "I am an experienced dev" etc
- deleted 4y ago[deleted]
- hotmustard 4y agoFunny thing, I've been moving Swift to C++, for real. I'm paying a price, but also getting some benefits. I'm not convinced that giving up on C++ and rewriting everything in a new language is a great idea. If I could get some compiler extensions to give me some experimental toys and syntactic sugar, I'd never be tempted by Rust/Swift/etc.
- nequo 4y agoFor what use cases have you been moving from Swift to C++ and what benefits have you seen? Unrelatedly, given that they all compile down to LLVM IR, in some sense Rust, Swift, and C++ are all syntactic sugar, aren’t they?
- hotmustard 4y agoYes, and no. I think Swift is doing some things that it can't optimize as well yet. I have some guesses about what that is (forced ref-counting, less control over memory layout, generics), but all I know is I'm getting significant performance gains in some graphics/geometry algorithms where I want to be a performance perfectionist and control everything. This is not a common use case. For building a basic app for iOS, Swift would be way easier. I've also decided to support other platforms, and when you want to build for Linux, Android, Windows... Swift loses appeal. Swift is quickly gaining on C++'s infamous "complexity". If you get in the deeper with generics, it's rough. I've seen recent experiments by Herb Sutter and Sean Baxter, giving C++ a new syntax or adding experimental features as compiler extensions. This makes me think C++ is going to continue to evolve. How exactly, nobody's sure. :)
- phil-m 4y agoWhy C++ though, when there's Rust? I understand that rewriting/refactoring projects from C++ to Rust may not be a good idea (in most cases at least). But starting a new project (or porting from a different language) in C++ doesn't make sense to me nowadays (unless pretty much any potential dependency of that project is written in difficult-to-wrap-in-Rust C++) Especially if you're coming from Swift anyways (which is more closer to Rust than C++).
- garbagecoder 4y agoThis but unironically.
- 1attice 4y ago[deleted]
- snickerer 4y agoIt is a bad discussion culture if discussing C++'s benefits is just a joke. "WE are better in every aspect, and joining the other team is sooo absurd, the idea is obviously a joke."
- VernorVintage 4y agoWhat was one of the benefits of C++ that was discussed? It seems like everything mentioned also comes with a terrible faustian bargain. For instance, C++ build systems are as plentiful as they are byzantine and torturous. Some new language features are heaven, but when your compiler hasn't implemented them yet, suddenly you're in hell. And the fact that bigots tend to feel freer in C++ communities than in rust communities certainly feels like a deal with the devil.
- nightfly 4y ago>Some new language features are heaven, but when your compiler hasn't implemented them yet, suddenly you're in hell So I pick up a Rust project about once a year, and I always try and keep with stable releases. Yet every project I find some small should-be-obvious thing that's nightly only, and I either have to swallow my frustrations and find a work-around or switch to nightly for the project -_-
- steveklabnik 4y agoWhich things have you run into lately? Just curious!
- amelius 4y agoThey should also add that there is no great GUI library for Rust.
- noncoml 4y ago> First, I consider myself a good enough programmer that I can avoid writing code with safety problems. Sure, I’ve been responsible for some CVEs (including font parsing code in Android), but I’ve learned from that experience, and am confident I can avoid such mistakes in the future. Yeah, well, joke is on you because I’ve heard this argument in real life.
- Yoric 4y agoA bit too trollish to be funny IMHO. Saying this as a Rustacean.
- VernorVintage 4y agoThe part where they said they didn't need inclusivity in computer science made me wanna cry because I didn't realize it was april fools and there are so many people who make that argument unironically.. also the part where they promoted make/cmake :(((( or claimed they can do unsafe code just fine... all these are real world positions that i've heard defended by old C++ barnacles v_v
- swader999 4y agoThis is the one day I really miss working in the office.
- VernorVintage 4y agoNo, bad. Bad. Do not propagandize for the office, even if you miss it. squirts u with windex BAD CAT!
- dakom 4y agoDon't let the turkeys get you down. We need pranksters and, more importantly, the humility to shrug off having been pranked when no harm is done. Some people just take everything a bit too seriously imho. Insightful points in the article too.
- deleted 4y ago[deleted]
- dan-robertson 4y agoThis should be good for making some of Raph’s libraries available to more serious game/application programmers. He’s been around for a while so he won’t make silly mistakes which means, given the difference in the number of RUST and C++ CVEs, the library will probably be safer. Not to mention faster because of the rewrite and better compilers.
- mrkramer 4y agoI know this is a joke but C++ is still huge for example in the gaming industry and I bet there are game devs who experimented with Rust, didn't like it and then moved back to C++.
- qwery 4y agoI like writing and humour. But it's already been April 2 for more than 7 hours, which is how long ago this was posted (on HN). So please only post serious things now out of respect for those in or near the arse end.
- teevorian 4y agoWell ... I fell for it. I'm just a beginner Rust programmer, I don't know the characters involved in Rust so I didn't know Ralhlinus, and I didn't read it on April 1. - so I feel I wasted my time, I was just irritated by some of the statements, but I couldn't tell fact from sarcasm. This is a very in-group kind of joke; I am left wondering what was sarcasm and what are facts.