22 ms·
The article falsely claims, "Rust is eclipsing C++". "Rust is desperately chasing after C++" would be accurate. It also fails to mention Apollo Aegis, coded in
by ncmncm 5y ago
The article falsely claims, "Rust is eclipsing C++". "Rust is desperately chasing after C++" would be accurate.
It also fails to mention Apollo Aegis, coded in Apollo's extended Pascal, and both at introduction and retirement was more advanced than Unix. Some key features still are not seen in Linux or most BSDs.
And, it fails to mention SerenityOS, in C++.
- ModernMech 5y agoIt depends on what they mean by popularity. If they mean % of developers using Rust vs C++ they are wrong. But I teach students both C++ and Rust, and by far Rust is preferred. It’s never even a contest. C++ is long in the tooth, and if you want to talk desperation, C++ is really struggling with its identity now that Rust is on the scene. Before there were some pretty good arguments to use it, but in light of Rust, the best argument for C++ is just that it has a larger ecosystem (which says more about how old C++ is than how good it is as a language). That argument becomes less convincing with each passing day. IMO in 2022 there’s not a good reason to start a new project in C++ unless that’s all you know, or you have some constraint tied to C++.
- jnash 5y ago99.999% of C++ developers either don't care about Rust or has never heard of it. There are 5 million+ C++ developers out there. And the number is going up.
- bayindirh 5y ago> IMO in 2022 there’s not a good reason to start a new project in C++ unless that’s all you know, or you have some constraint tied to C++. I personally don't agree. I can start with performance and continue with a better compiler ecosystem, and add suitability for low resource applications. I'm just not scratching the surface here. Rust is not bad, but it's not a replacement of C++. They aspire to be different things.
- deleted 5y ago[deleted]
- School-Cotton 5y agoWhen is C++ higher-performance than Rust?
- bayindirh 5y agoHigh performance and scientific computing, or more generally when you transfer a lot of data structures via pointers to a lot of threads. In that scenarios, a half second performance difference in main loop can translate to hours in long runs. The code I'm developing is running with ~1.7M iterations/core/second. Every one of these iterations contain another set of 1000 iterations or so (the number is variable, so I don't remember the exact mean, but the total is a lot). Also, this number is on an 8 year old system. More benchmarks are here: https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/gpp-rust.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- ModernMech 5y agoThe link you provided shows C++ and Rust both performing best in various benchmarks. Seems like a wash to me, and to the extent one beats the other it's marginal. Which is to be expected because as long as the language is compiled and the compiler is good enough, you should be able to get as much performance out of it as your CPU can handle.
- bayindirh 5y agoThe numbers might look small, and indeed for most cases it can be considered a wash, but in some cases, these small differences return as hours. For example, I'm using a lot of vector, matrix and array accesses in my code. A lot of these are copied around for computation. Moving that amount of data will trigger a lot of checks in Rust, and will create a slowdown inevitably.
- zozbot234 5y agoC++ is really struggling with whether or not to break their ABI. But their "identity" is clear enough - much like C, they want to support their existing code, while still opening up support for newer features if possible. Rust could actually benefit from cribbing a few things that are now getting defined in C++, such as their support for heterogenous executors.
- zabzonk 5y agoC++ doesn't have a standardised ABI. I'm not aware of any languages that do, but I would be interested in any more information on this.
- legalcorrection 5y agoCOM and Windows Runtime (WinRT) provide standardized ABIs across multiple languages. With the WinRT language projections, it's just like writing 'normal' code.
- pjmlp 5y agoAnd with C++/WinRT you even get back the experience of how it was like to do ATL development.
- legalcorrection 5y agoSo I gather that, much more than previous COM projections and templating libraries, C++/WinRT is much nicer to work with. And you can target the WinRT ABI with Rust, .NET (C#, F#, etc.), Python, and JS too.
- pjmlp 5y agoI completely disagree, C++/CX was the best that Microsoft ever had closer to C++ Builder and they killed with their office politics. On top of that, the C++/WinRT folks are adamant to push their east const preference into every Microsoft customer. If you enjoy editing IDL files without tooling support and merging generated files by hand, please do.
- dan-robertson 5y agoIf you have a very deep understanding of C++ then you are potentially yourself a good reason to start a project in C++ and this statement is true of any language. Knowing the language very well can mean more time focusing on the actual goals and less time messing around with incidental language things. C++ is not sufficiently bad that mastery of it doesn’t trump other concerns for personal projects. Even in companies you are often likely to find more C++ expertise than Rust expertise.
- jcelerier 5y agoCan you point to a Rust alternative to https://doc.qt.io/qt-5/qtreeview.html https://doc.qt.io/qt-5/qtreeview.html ?
- scoutt 5y agoExactly. I think you managed to summarize all my concerns in a single sentence. https://www.areweguiyet.com/ https://www.areweguiyet.com/
- steveklabnik 5y agohttps://slint-ui.com/ https://slint-ui.com/ is an in-progress one from some ex-Trolltech folks.
- jcelerier 5y agoAs much as I have an extreme confidence in the technical ability of the involved folk, even TQTC did not manage to replicate it in an useful enough way so far in QML, and QML has been around for something like 11 years now.
- steveklabnik 5y agoYeah, I'm certainly not claiming it's equivalent today, I haven't even tried a demo. Just a thing to watch if you're interested in this space.
- ilovecaching 5y agoI don't think you understand just how much of your system and the libraries out there are C/C++. Popularity isn't a measure of entrenchment. C/C++ will likely exist forever because the industry isn't going to rewrite every single piece of the system into Rust. And it isn't like you can just go to one community and ask them to switch. These are huge federations that talk to each other using C/C++ bindings and have hashed out protocols over years and years of board meetings. I think Rust has a place. We can build new things in Rust or replace some things with Rust. But acting like everyone should learn Rust and C/C++ has no value is dangerously ignorant.
- kllrnohj 5y ago> C++ is long in the tooth C++ is mature, there's a difference. It's definitely not "long in the tooth" as it still has plenty of modern features & niceties and is getting more all the time. > C++ is really struggling with its identity now that Rust is on the scene C++'s identity struggles have nothing to do with Rust whatsoever. It's struggling to balance ABI & historical compatibility with moving the language forward, that's about it. And that's just something many mature languages face at some point (see Python3 for example). Beyond that struggle of supporting legacy code, there's no identity crisis with C++ at all. > the best argument for C++ is just that it has a larger ecosystem (which says more about how old C++ is than how good it is as a language). That argument becomes less convincing with each passing day. It's still an incredibly convincing argument. Rust has decent C interop, but it's not especially seamless to do safely. But Rust's interop with C++ is rather complicated. So if you have any C++ dependencies, you're almost certainly far better off to just go with C++. Even if you just have C dependencies and someone else hasn't yet made a crate for it, you might still be better of with C++. Particularly since many of the Rust crates that bind to popular C & C++ libraries are not owned or maintained by the library in question. So you're entering into a bit of a sketchy maintenance world. And there's already been churn & abandonware here, for example the various projects (including one from Mozilla/Servo!) to bind to libpng that were then later all abandoned, and you're supposed to migrate to rewrites of PNG support in Rust like LodePNG. This is not ignorable churn & risk. It can be fun, and if it's a hobby project absolutely go for it. But if you're on the clock to ship & maintain something, it's a risk you must consider quite seriously.
- zahllos 5y agoI mostly agree. C++ is mature, has standards and a whole array of production ready libraries. If I wanted to build a production cross platform GUI app today and not use electron (vomit) I would likely use Qt for it. Rust has nothing that is quite ready yet to offer there. However, my overall view is that Rust is the right direction. If I had to improve C++, it would look a lot like Rust: move bounds checking and ownership to the compiler not the template compiler, remove classes, introduce traits and make C++ have concepts that don't require me to type every punctuation symbol on my keyboard to use, const by default. Getting the compiler to do some of this checking by default is exactly what I want. If we can have an Ada/Spark style subset via Kani, also done at compile time to check correctness, even better. > It's still an incredibly convincing argument. Rust has decent C interop, but it's not especially seamless to do safely. I would make this statement slightly stronger. If you interop with C code and there are bugs in C code, all bets are off. You don't get any magical protection because your main routine is written in Rust. Cross-language safety, e.g. C++/Javascript, for example, is a very difficult problem. Here's a discussion of C++ and Rust https://dl.acm.org/doi/fullHtml/10.1145/3485832.3485903 https://dl.acm.org/doi/fullHtml/10.1145/3485832.3485903 If you want a tl;dr of that paper, it is that memory corruptions in C or C++ code sharing the address space of safe Rust code can make safe Rust code unsafe too. There have been plenty of attempts to study for example the interactions between browser C++ and the various runtimes a browser hosts. The compact you are making with the Rust compiler when you type 'unsafe' is that you are saying you have verified the correctness of that code: that it is in fact already safe and the compiler should not (probably because it cannot) check it. The same is true of any FFI code you use. However, this is not how many people actually _use_ Rust. Here for example is a 2 year old unfixed segfault in a Rust crate caused by interfacing with non-Rust code: https://rustsec.org/advisories/RUSTSEC-2020-0159 https://rustsec.org/advisories/RUSTSEC-2020-0159. This a) demonstrates the issue and b) demonstrates that random crates pulled off crates.io can contain safety issues for 2+ years with no fix.
- pjmlp 5y agoThose students are up for a surprise when they get to do anything graphics or HPC related.
- aeonik 5y agoCan you explain more? I don't have any experience to infer what your comment means.
- tux3 5y agoI think they mean that C++ has a lot of momentum in graphics and HPC. So in their model of the world, students who learn Rust would be surprised that there are people who do not use Rust.
- pjmlp 5y agoHPC is all about C, C++, Fortran, Python (as scripting language), and now Julia is slowly being the new kid in town. Stuff like OpenACC, OpenMP and MPI are expected to be in the box, regardless of the language. On the graphics space, Khronos, NVidia, Intel and AMD are driving the adoption of standard C++ as compute language. NVidia now has many key contributors to ISO C++ on their payroll and as shown at GTC 2022, wants to make CUDA the best GPU implementation of such features. Then on game consoles, C++ is the main language on the SDKs, alongside C# and Unity. One can naturally use other stacks, like Embark Studios is doing with Rust, but then it is on them to spend development resources on making it work, and deal with possible integration issues.
- scythe 5y agoMost of the interfaces you're discussing are more-or-less "purely functional", though. Interop overhead is going to be a lot less when you're squaring a matrix than when you're trying to write an event loop. In fact, most people who use those C++ libraries never touch C++, as you've pointed out yourself: they use Python or (recently) Julia. The ecosystem as it exists is already a hodgepodge of C[++] and Fortran, and while the interop between those might be annoying if you were building a video game, a NumPy user doesn't care if one subroutine is in C++ and the next one is in Fortran. So, I don't see why one more backend language would be a problem, realistically.
- DrBazza 5y ago> But I teach students both C++ and Rust, and by far Rust is preferred. It’s never even a contest. Why is Rust preferred though? Is it "fearless concurrency" (or whatever the old tag line was), a more modern stdlib, or is it Rust's tooling with `cargo` rather the shitty tool-scape of C++'s make/cmake/meson and vcpkg/conan and whatever else.
- e3bc54b2 5y agoAs a newbie who only learned Java and JS in bootcamp, and C in EE, Rust's tooling is absolutely phenomenal. Things just work, and that is a rare experience.
- ModernMech 5y agoIt’s a rare experience but once you’ve had it, anything less becomes unacceptable. Rust has ruined me for so many languages, my bullshit tolerance used to be much higher.
- pjmlp 5y agoBorland languages and IDEs did that to me, that is the minimum bar.
- adwn 5y ago> Why is Rust preferred though? Is it "fearless concurrency" Yes. > a more modern stdlib Yes. > is it Rust's tooling with `cargo` rather the shitty tool-scape of C++'s make/cmake/meson and vcpkg/conan and whatever else Yes. I don't mean to be flippant. The entire experience with Rust is just so much better than with C or C++, and that's even before you get to the actual language.
- Koshkin 5y ago> by far Rust is preferred. It’s never even a contest But it is (for the most part) C++ that pays the bills.
- tialaramex 5y agoJudging from the same Stack Overflow polling, only by about 3:1 and so we might also say it's really Javascript paying the bills since that's what is most used rather than C++. Just not to write operating systems. If we're thinking about University students it's very likely the ratio is even smaller by the time they graduate and are looking for employment. Rust jobs grow, there are lots of new Rust codebases, and they need maintenance people just the same as C++. You may have fewer mysterious unsafety bugs to fix but your customers still have changing requirements, other people's APIs still change, so you aren't going to go hungry any time soon programming in Rust any more than C++ And if we're talking about in-house training, whatever they are teaching pays the bills, the employer isn't sending employees to learn how to do stuff they've no use for, otherwise they'd just give you indefinite leave on full pay.
- ncmncm 5y agoWishing is very popular, but makes a poor foundation for argument. Or reputation.
- tialaramex 5y agoNevertheless, even if you wish it was otherwise, the thing paying the bills for the most people isn't C++ it's Javascript. Brendan Eich's slapped together Lisp clone with semi-colon language syntax is paying the bills more than Bjarne's "What if C but with a kitchen sink of extra stuff bolted on more or less at random?" language. They're both terrible in different ways, but at least Brendan had the excuse of a hard deadline.
- ncmncm 5y agoIt would be miraculous if even a single person were paid $1M to code JS. But many get that coding C++.
- creatonez 5y agoRust is absolutely dominating the very tiny domain of greenfield OS development.
- jnash 5y agoSo Rust is dominating an area that has zero impact on the world. While the world runs on C/C++. OK thanks. Noted.
- ncmncm 5y agoRust is anyway making a better showing there than other places.
- Gigachad 5y agoIt's also made keys steps in to Linux. I haven't checked the latest state, but as of last year it was pretty much approved as the way to write new drivers on Linux.
- tialaramex 5y agoRust for Linux is not landed, and so you can't write Linux drivers in Rust even on Linux Next (the git branch where in-progress work lives before Linus might ship it in an actual Linux kernel) It's probably of the order of a year out.
- jwatt 5y agoI'm not sure it's "desperately" chasing; its trajectory looks positive. For example, in the 2019 Stack Overflow developer survey[1] only 3% of professional developers reported using Rust. A year later[2] it was 4.8% and a year after that[3] it was 6.4%. So based on that metric (of debatable value), professional developer use may have doubled in two years. For reference, in the SO surveys C++ and C use was about 20% and 16%, respectively and, if anything, slowly declining (as a percentage of respondents, of course). 1. https://insights.stackoverflow.com/survey/2019#technology-_-programming-scripting-and-markup-languages https://insights.stackoverflow.com/survey/2019#technology-_-... 2. https://insights.stackoverflow.com/survey/2020#technology-programming-scripting-and-markup-languages https://insights.stackoverflow.com/survey/2020#technology-pr... 3. https://insights.stackoverflow.com/survey/2021#technology-most-popular-technologies https://insights.stackoverflow.com/survey/2021#technology-mo...
- kevin_thibedeau 5y agoPHP had a positive trajectory too. Rust is riding a wave of interest but most are going to revolt against its complexity.
- wk_end 5y agoThat sounds plausible in the general case...but we’re putting it up against C++ here, which is at least as (probably more) complex.
- ncmncm 5y agoLanguages get complex as they come to address more real needs. Rust is getting more complex to address needs. Dilettantes will abandon Rust for next year's fad, and those remaining will continue strengthening it for their serious use. Rust will soon be wholly as complex as C++; or it will fizzle. It could still do both. It would be disappointing if Rust were to fizzle unless it is supplanted by something better.
- tialaramex 5y ago
- Decabytes 5y ago> In terms of popularity, depending on which survey you look at, Rust is stalking or eclipsing C++ The full quote is in reference to popularity. Which if you look at the stack overflow developer survey is definitely true
- ncmncm 5y agoStack overflow is a sampling of hipsters. It is doubtful even 0.1% of professionals ever look at it. Relying on its numbers, or Tiobe's, is purely an exercise in wishing. Wishing is totally allowed, but is not a good look.
- lproven 5y agoThe Rust vs C++ thing is also addressed in the comments on the Reg. SerenityOS is addressed elsewhere in the comments here, so I won't repeat myself. DRY is a maxim, right?