|
|
Log in / Subscribe / Register

New Tools

New Tools

Posted Sep 23, 2024 19:08 UTC (Mon) by richard_weinberger (subscriber, #38938)
Parent article: Resources for learning Rust for kernel development

I’d like to clarify something that isn't fully addressed in this article. While I completely agree that it's reasonable to expect a developer to learn new tools, I want to emphasize that Rust is more than just another tool. Rust requires adopting a different mental model for programming. Trying to apply familiar idioms from C can lead to significant challenges and frustration when working with Rust.

That being said, I encourage everyone to learn Rust, but keep in mind that it comes with its own set of idioms and approaches that are essential to understand.


to post comments

New Tools

Posted Sep 24, 2024 5:40 UTC (Tue) by dirklwn (subscriber, #80581) [Link]

> Rust requires adopting a different mental model for programming

Yes, exactly!

And the question we should discuss about how to make it easier for people with the C-kernel mental model to adopt.

New Tools

Posted Sep 24, 2024 7:17 UTC (Tue) by Wol (subscriber, #4433) [Link]

> Trying to apply familiar idioms from C can lead to significant challenges and frustration when working with Rust.

But isn't that true for ANY change in language?

I program C like it's Fortran. Using DataBASIC requires a completely different way of thinking. Scheme, well... and of course there's Forth ... :-)

Even comparing Scots and English :-)

Cheers,
Wol

New Tools

Posted Sep 24, 2024 9:43 UTC (Tue) by LtWorf (subscriber, #124958) [Link] (7 responses)

> perhaps we can just never compile a buggy driver.

I'm not comfortable with the mental model that rust programs have no bugs to be honest.

New Tools

Posted Sep 24, 2024 10:14 UTC (Tue) by Wol (subscriber, #4433) [Link] (6 responses)

The computer is an idiot, it knows not how and when,
In fact the only thing it knows is 1+1 is 10

It's not that Rust programs don't contain bugs. It's that a Rust program is much more likely to do what you (thought you) told it to. The Rust compiler is very aggressive about coming back and saying "I don't understand", whereas the C compiler will just go off and do its best.

Doesn't stop Rust being full of "Do What I Mean Not What I Say" bugs ...

Cheers,
Wol

Localised bugs

Posted Sep 26, 2024 10:00 UTC (Thu) by gmatht (subscriber, #58961) [Link] (5 responses)

As I understand, bugs in safe rust are likely only to affect the module in which the bugs occur (and which call the affected module, etc). For example, if you had an intern who was a bit of a space cadet, you could get them to clean up the gazpacho soup module. Sure, the soup dispenser might start endlessly dispensing "trout a la creme", but an off-by-one error shouldn't cause the reactor to vent radiation into the crew quarters.

Localised bugs

Posted Sep 26, 2024 13:35 UTC (Thu) by pizza (subscriber, #46) [Link] (4 responses)

> but an off-by-one error shouldn't cause the reactor to vent radiation into the crew quarters.

If your reactor core is capable of venting radiation into crew quarters and/or your soup dispenser is connected to the reactor in any way, you have far more serious problems than the language the language used to write their respective control software.

Localised bugs

Posted Sep 26, 2024 14:15 UTC (Thu) by Wol (subscriber, #4433) [Link] (1 responses)

> If your reactor core is capable of venting radiation into crew quarters and/or your soup dispenser is connected to the reactor in any way, you have far more serious problems than the language the language used to write their respective control software.

Doesn't that describe the modern car, though? :-)

Cheers,
Wol

Localised bugs

Posted Sep 26, 2024 15:11 UTC (Thu) by pizza (subscriber, #46) [Link]

> Doesn't that describe the modern car, though? :-)

As someone whose $dayjob currently revolves around SoCs targeting next-gen Automobiles, yes and no.

Yes in the sense that these systems _may_ share common physical communication buses, but No in the sense that when they do, there are figurative (as well as literal) firewalls designed into the overall system to ensure only suitably blessed messages are acted upon by any given component.

That isn't to say that bugs can't occur [1], just that this class of bug is nearly always due to incorrect/incomplete specifications, typically due to poorly-thought-out scope creep [2], not traits of the language used to implement the specification.

[1] I recall reading that someone was able to trigger brake lockup on some Jeep models via their cellular modems
[2] eg by exposing what was once a completely private and trusted bus to the open internet with no authentication to enable remote start capabilities.

Localised bugs

Posted Sep 26, 2024 16:22 UTC (Thu) by james (guest, #1325) [Link]

For what it's worth, I think gmatht was referring to the British sit-com Red Dwarf, where they explored this management failing in depth.

Localised bugs

Posted Oct 14, 2024 9:52 UTC (Mon) by sammythesnake (guest, #17693) [Link]

I think AJ Rimmer's defence council described anyone who would craft such a situation as "a yogurt"...


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds