6 ms·
I honestly don't think anyone suggests dropping C in favor of Rust. Make no mistake, I love Rust and I think it's the best language that's been developed in thi
by axegon_ 6y ago
I honestly don't think anyone suggests dropping C in favor of Rust. Make no mistake, I love Rust and I think it's the best language that's been developed in this century.
Firstly, C is where it is because it's well established and has solid foundations and it has remained pretty much unchanged for decades. Rust on the other hand is changing rapidly and fast, which is something you wouldn't want for a language that powers your kernel
Secondly, the Rust community is painfully small.
Thirdly, Rust lives in the LLVM world and I don't see it coming into the GCC world anytime soon. Which is a huge problem, as far as replacing C goes(namely licencing might be problematic in some cases).
Lastly Rust, in terms of it's nature, is more closely related to C++ rather than C. If Rust was to replace something, it has a much better chance against C++ than C.
I truly want to see the day I open up linkedin, go to the jobs section, type in rust and see 6000 new job offers. But at this point in doubt this day will ever come.
- steveklabnik 6y ago> Thirdly, Rust lives in the LLVM world and I don't see it coming into the GCC world anytime soon. You may be surprised... we'll see, and it very much depends on what you mean by "soon," but there have been some interesting rumblings here.
- ausjke 6y agomostly true. it took me a while to decide, I eventually picked up c++. modern c++ is very different nowadays, and it keeps evolving fast, to some extent many modern languages are having the same new features, c++ is becoming better and better for each new standard release, and g++/clang++ also keep up with new sanitizer, static analysis, excellent warning optional flags etc, in fact it is now very hard to make those stupid mistakes these days with modern c++ in a good IDE(even vim with the right configuration). I will keep my eye on rust, I use a few rust utilities myself, but for the heavy duty of my carerr, c/c++ remains to the the top choice.
- saagarjha 6y agoC++ does however still leave the door open for the not-so-stupid mistakes that are still memory safety issues ;)
- pizza234 6y ago> in fact it is now very hard to make those stupid mistakes these days with modern c++ in a good IDE(even vim with the right configuration). Google has, supposedly, some of the best engineers¹ in the world, and the best tooling in the world, and they keep pouring tons of resources on the best engineers and the best tools. Yet, the same memory safety errors (which Rust, or any hypothetical memory-safe language, prevent entirely) keep popping again, and again. Have you heard of CVE-2020-0022? It's amazing. In this perspective, pouring resources and effort on those languages is like trying to open a door by banging the head harder. It's fine if you like it, just don't pretend it's the optimal way to open doors. ¹=edited, to make it clearer what I wanted to convey.
- ausjke 6y agohttps://youtube.com/watch?v=iOBXVOAbpdY https://youtube.com/watch?v=iOBXVOAbpdY this is a 8-minute study on how rust is safe comparing to C, the summary is that, there is a long way to go, many rust code is still unsafe today.
- JT2FG 6y ago> I honestly don't think anyone suggests dropping C in favor of Rust. Depends on where you look. In some online spaces a lot of Rust advocates do.
- jeroenhd 6y agoI do believe there's a "drop C and pick Rust" crowd, or multiple even. When it comes to building user mode applications like desktop programs with QT or GTK or what have you or command line programs such as curl and wget, I think these crowds have a valid point. Most of those applications are written in an object oriented language though. There's also a very small group that's very militant about everything, including kernels and microcontroller programs, being rewritten into Rust. I don't pay too much attention to that crowd; C has its place and it's not the ultimate solution to programming languages. Rust won't replace C in the kernel, but I do think we will see tooling for our network clients, file indexing and perhaps even version control slowly switching languages (if they still rely on C, that is). These will all be new tools though, because rewriting an old application into Rust and maintaining compatibility and performance is a big challenge.
- bluejekyll 6y ago> Rust won't replace C in the kernel, but I do think we will see tooling for our network clients, file indexing and perhaps even version control slowly switching languages (if they still rely on C, that is). Do you mean the Linux kernel, XNU, Free/Net/OpenBSD, or other existing kernel's? There are plenty of examples of folks successfully building kernels in Rust. The likely hood of any of the major kernels adopting it (beyond drivers) is probably low. I expect the only reason that would happen is if any of the folks behind those kernels decide that they actively want to migrate the entire thing away from C in the long-run. Ground up new kernels in Rust are very feasible, though. Will any of those attract the community and contribution that we see in Linux? That's unlikely, but it's not impossible, as your comment implies.
- jeroenhd 6y agoI'm not saying it's impossible to create a Kernel in Rust, but I don't think Linux or any of the BSDs will switch to anything other than C for their primary kernel development language. The only option for kernels that are mostly Rust I can see is a ground-up kernel, but those rarely succeed if ever. There's been small kernels in C# for a while now, for example, but those are usually no more than a fun experiment. Fuchsia is the closest thing to a completely new kernel that I can think of and despite its age and the amount of people working on it, it's not used outside of lab environments. Perhaps in ten or twenty years a new kernel will replace Linux, and that might very well be written in Rust.
- masklinn 6y ago> I honestly don't think anyone suggests dropping C in favor of Rust. librsvg largely did. Brian Cantrill was very bullish, and apparently still is given… well the name of his company is a reference for starters, and if you look a Oxide's public repos those with C as the main language are all forks. > Lastly Rust, in terms of it's nature, is more closely related to C++ rather than C. If Rust was to replace something, it has a much better chance against C++ than C. That's very true, but at the same time C++ is way more complicated than Rust, with features interacting in subtle pitfalls and a lot more implicit (and often undesirable) behaviours e.g. the Chromium Cursor / GDI leak where a missing (therefore implicitly-declared) copy-assignment operator led to a leak of invisible kernel resources. Not all of the people who'd rather do C than C++ do so because they don't want anything better than C. Again I'll cite Cantrill who very famously and publicly hated C++.
- caeril 6y agoRight, well, Cantrill was also bullish on Node.js of all things, somehow. I'm not sure I'd take a snapshot of a single moment of his ever-evolving advocacy to be justification of what the current Right Thing(tm) is. That said, Oxide is definitely doing The Right Thing(tm) selecting Rust, since they explicitly NEED boot and system board firmware that A. Is fast native code and B. Is as close to semi-sorta-provably-secure as one can get. Rust fits that specific bill better than anything short of C/ASM and NASA-level code validation processes.
- bcantrill 6y agoWow, tough crowd! I don't know that I -- or anyone that knows me -- would accuse me of "ever-evolving advocacy", but yes, I did see promise in node.js in 2010[1]. And yes, we at Joyent built systems on node.js -- but we also added unprecedented debuggability and observability along the way.[2]. While my views may not be "ever" evolving, they're also not incapable of it: by 2014, it was clear that node.js was diverging from my personal hopes for it -- that it was not going to become suitable for infrastructure software. While this was distressing at the time, I came to view this as a divergence in values -- a realization that I described at length in a talk in 2017.[3] To the matter at hand: yes, I have fallen in love with Rust.[4] Yes, I think it is a good fit for system software.[5] And yes, this has served as a bonding force at Oxide -- but as much (if not more!) for the values that it reflects than for it itself.[6] [1] http://dtrace.org/blogs/bmc/2010/08/11/the-node-js-demographic/ http://dtrace.org/blogs/bmc/2010/08/11/the-node-js-demograph... [2] http://dtrace.org/blogs/bmc/2012/05/05/debugging-node-js-memory-leaks/ http://dtrace.org/blogs/bmc/2012/05/05/debugging-node-js-mem... [3] https://vimeo.com/230142234 https://vimeo.com/230142234 [4] http://dtrace.org/blogs/bmc/2018/09/18/falling-in-love-with-rust/ http://dtrace.org/blogs/bmc/2018/09/18/falling-in-love-with-... [5] https://www.youtube.com/watch?v=HgtRAbE1nBM https://www.youtube.com/watch?v=HgtRAbE1nBM [6] https://www.youtube.com/watch?v=2ajos-0OWts https://www.youtube.com/watch?v=2ajos-0OWts
- abnercoimbre 6y agoThe simplicity of the C language remains a necessary property for critical industries around the world. These industries are not on social media talking about programming languages either :P I'm rooting for Zig and Odin as the better evolution for C. So is Carmack, at least for Zig [0] it seems. [0] https://twitter.com/ID_AA_Carmack/status/1300579679951294464 https://twitter.com/ID_AA_Carmack/status/1300579679951294464
- bluejekyll 6y agoThat comment doesn't really seem to support your statement. He may or may not be rooting for Zig, but it seems to be a stretch to derive that from this statement, "I have been checking on the progress for a while, and I like what I see, but I haven’t coded in it." In the same thread on Rust when asked, "What’s a better modern choice?", the response was: "Rust would be the obvious things [sic], and I don't have any reason to doubt it would be good, but I haven't implemented even a medium sized application in it." https://twitter.com/ID_AA_Carmack/status/1299574198365495297?s=20 https://twitter.com/ID_AA_Carmack/status/1299574198365495297...
- abnercoimbre 6y agoI did say "it seems" to emphasize that. Fair enough though. C is so much of a lingua franca -- especially at the ABI boundary -- that any language wishing to "replace" it must properly absorb C. Zig is the language in town succeeding in that effort.
- bluejekyll 6y agoCould you point to areas where you see Rust's support of the C ABI as being less than adequate than Zig? I haven't used Zig but have read about it, and am unaware of where it has improvements over Rust in this area. The specific issues I personally have run into with Rust and the C ABI are varargs (possible just not simple) and then dealing with function interfaces defined through CPP macros. Are there others you've seen?
- 6y ago