7 ms·
Google says replacing C/C++ in firmware with Rust is easy
- wmf 2y agoOriginal source: https://news.ycombinator.com/item?id=41458508 https://news.ycombinator.com/item?id=41458508
- capitainenemo 2y agoI mean, on the plus side, this article doesn't have broken javascript regexes that trigger browser safety aborts like the javascript on the original source.. [edit] hum. couple of people didn't appreciate that clearly, but if you review the comments on the linked HN post, a large number of them are the discussion of the page being completely blank in firefox. If you review the firefox bug, it is apparently about a recursion overflow in the regex, where they note that chrome does some disturbing things to make it complete...
- Narhem 2y agoNot surprised, rarely is it worth rewriting an entire codebase though. Not sure who would do that or what the implications might be for replacing all the say Python code with cpp.
- Kenji 2y ago[dead]
- saltylicorice 2y agoAndroid engineers don't really speak for the whole of Google
- linotype 2y agoIs that true of any group at Google? What’s your point?
- mianos 2y agoThe title is "Google says". It's pretty normal for people to assume some public statement is like this would be a company thing, not just some single person of very small team.
- OJFord 2y agoIt's more like 'Android engineers say [...]' than 'Google says [...]', which kind of implies PR dept. or someone very senior but not so senior they're just named.
- zeroCalories 2y agoI just can't bring myself to spend time learning Rust when all the demand is for C++, C, Java, Typescript, Python, etc. Feels like we're going to be stuck in this limbo forever similar to languages like Kotlin.
- nfrmatk 2y agoIt seems to me that the point of the article is that "all the demand" is not just for C++, C, Java, Typescript, Python, etc. There is increasing demand from larger companies for Rust. No one is forcing you to learn Rust. You don't have to bring yourself spend time learning it. You can keep writing those other languages. Those languages have been around for a while and they'll continue to be around for a while more. Rust is just getting some time on that stage as well now.
- zeroCalories 2y agoThere's always demand, but at what cost? Mixing languages sucks. Rewriting stuff is not always an option. New projects could use Rust, but will you be able to get the head count? There are whole armies of skilled C++ devs, but only a small group of competent Rust devs. This is the exact same problem Kotlin ran in to.
- throwawaymaths 2y agoI think some dyed in the wool programmers are not afraid to learn something new but from experience see some nightmarish patterns in rust (e.g. c++ style templates for generics, phantom) and also watch less experienced programmers/architecture astronauts successfully argue to move things to rust without considering the future pain and are legitimately worried about being eventually forced to use it. Doesn't help that e.g. government is now saying "don't use memory unsafe languages".
- mav3ri3k 2y agoFair enough. I have personally experienced pain with phantoms. But then what would you advice to do ? There are nightmare patterns in rust and c++. Looks to me as pick your poison just that one is new and other has been around for fair bit.
- trott 2y ago> Google was already sold on the idea, having concluded that its Rust developers are twice as productive as its C++ engineers. Not so. The actual study compared the cost of writing something in C++ to the cost of porting it to Rust.
- Joel_Mckay 2y agoSome people are going to embrace what they want to hear. Rust has a different use-case than C, and just like C people tried to apply it in every situation regardless of whether it was appropriate. Personally, running some shell script on a website is not the preferred installation method of a trusted compiler. Also, porting something that must make low-level memory unsafe operations anyway... into another bodged build ecosystem is pointlessly ridiculous, and outright dangerous in some settings. At this point, the Rust AstroTurf campaign has gone full Troll. lol =3
- ycombinatrix 2y agoDon't be mad that C is being deprecated. Be happy that it existed. Lol =3
- Joel_Mckay 2y agoMy point was if you are going for a safer high-level llvm language, than there are far better options than Rust... which includes many of the same core issues C encountered. All software is terrible, but some of it is useful... We have seen several languages go on the same trajectory Rust is taking. https://en.wikipedia.org/wiki/Garbage_in,_garbage_out https://en.wikipedia.org/wiki/Garbage_in,_garbage_out (you should probably assume the Von Neumann architecture will end soon too... half joking... ) Have a nice day, =3
- anonfordays 2y ago>My point was if you are going for a safer high-level llvm language, than there are far better options than Rust Mind naming any? Mind naming any that aren't just toy languages?
- jay-barronville 2y agoAs someone who writes, reviews, and maintains lots of C code professionally, here’s what I think a lot of Rust advocates don’t understand: We see and understand the benefits of Rust. That’s no longer something we need to be sold on. Every C programmer who’s written and reviewed any amount of nontrivial C code likely has firsthand experience dealing with memory safety bugs that would simply disappear with a memory-safe language. The ultimate problem is that most of the muscle memory you’ve built using C over the years becomes useless when writing Rust due to so many of the semantic differences. If you were an expert and highly productive C programmer, your productivity will go out the window for what feels like a long time until you feel even just comfortable writing Rust. That makes Rust a very hard sell for C programmers who simply want to get things done. This is an area, by the way, that I think Zig does extremely well at—it provides safer semantics (despite its lack of guaranteed memory safety à la Rust) in a rather simple language and without rendering so much of your experience useless.
- empath75 2y agoThis is a problem that will resolve itself with time as C developers retire and new projects start in Rust.
- doe_eyes 2y agoC is 52 years old; C++ is nearly 40. That's more than a generation. Yet, I'd bet that there are more up-and-coming developers learning C/C++ than Rust today. The problem isn't just personal preference or inertia. It's that all mainstream OSes, libraries, and system software are written in C/C++. You can't exactly ignore this and not learn the language if you want to work in this space. Of course, there are many developers who don't work with system-level stuff, and they may be perfectly fine just knowing Java or JavaScript, but Rust is not positioning itself as a direct competitor to that.
- xelamonster 2y agoHow is "too much existing software uses C/C++" not just inertia? That can also change with time.
- QuiEgo 2y agoRust is interesting but still has some pain points. - Compile times. This, above all else. - As an embedded dev: no_std is still rough around the edges, which the original Google blog post captured pretty well. They didn’t talk about PACs - the PAC paradigm also feels needlessly complicated - whoever wrote it really loves their zero-sized types and made it verbose to the point where the solution feels worse than the problem (at least to me) for things like using GPIO lines. - Rust has a history of shipping serious bugs (see, floating point recently), and you basically have to constantly update your rust version. Not ideal for commercial products, which want stability. - All of the RTOS options are also young. None of the major existing ones (e.x. FreeRTOS) support Rust natively. You’re not just asking people to learn the language, but start over on libraries and platform as well. - The community is weird. If you don’t drink the koolaid you will be attacked. Rust is constantly getting better, and the pain points of C impact real peoples lives in very real ways (security bugs that have led to people truly getting hurt), so Rust feels inevitable, but it’s still early days and pain.
- aw1621107 2y ago> Rust has a history of shipping serious bugs (see, floating point recently) For those of us who may be out of the loop, could you elaborate on these points?
- QuiEgo 2y agohttps://github.com/rust-lang/rust/pull/128271 https://github.com/rust-lang/rust/pull/128271 This one was fun too: https://blog.rust-lang.org/2024/04/09/cve-2024-24576.html https://blog.rust-lang.org/2024/04/09/cve-2024-24576.html Basically, anything that gets a .1 or .2 type release. Also, shout out to the Rust community for maintaining and fixing issues quickly; not trying to pick on them, just trying to show some examples to show Rust is still young and very much a moving target.
- aw1621107 2y agoAh, optimizer bugs are fun. Does make me wonder how their error rates compares to that of the other major compilers. > This one was fun too: https://blog.rust-lang.org/2024/04/09/cve-2024-24576.html https://blog.rust-lang.org/2024/04/09/cve-2024-24576.html To be fair, that affected a bunch of other languages as well so Rust is in (questionably) good company there. I feel the need to keep your Rust install up to date might arguably be more ecosystem-dependent than anything to do with Rust itself. If stuff you're using requires a newer rustc then you don't have much choice but to upgrade, but if you're fine using something older and/or your dependencies keep support for older versions of rustc then you can probably get away with a lot fewer updates.
- oglop 2y agoAll this talk is pointless. The DoD is what will incentivize people to finally make the switch permanent. You want the real funds, you’re gonna have to write in a memory safe language going forward. At least that’s what the US government says.
- deleted 2y ago[deleted]
- bravetraveler 2y ago(not a judgement, just an observation) Google, the conglomerate with the resources to bless us with Go and Kubernetes; another language and a container orchestration platform created with it. Their easy isn't my easy. You would think distributing firmware and flashing would be routine; several vendors have shown me it isn't