|
|
Subscribe / Log in / New account

Rust bandwagon

Rust bandwagon

Posted Jan 10, 2023 12:12 UTC (Tue) by kleptog (subscriber, #1183)
In reply to: Rust bandwagon by khim
Parent article: Welcome to 2023

> if you give people an easy-to-use affine type system then they can solve almost all practical memory handling problems without GC, just with a small amount of unsafe code.

The thing I found most amazing was its impact on some junior developers. They'd start with C and pointers and get themselves tangled into knots keeping the ownership/concurrency/etc straight. But after using Rust for a while they'd internalised the model such that after that coding C became much less scary because they had a model that they knew that worked, and all C needed was some boilerplate that the Rust compiler handles for you (i.e. working without guardrails).

The resulting programs became better simply because they understood the ownership of the objects they're manipulating, rather than just throwing pointers around. Some of us had to learn that the hard way using debuggers on segfaulting programs.


to post comments

Rust bandwagon

Posted Jan 10, 2023 17:08 UTC (Tue) by farnz (subscriber, #17727) [Link] (2 responses)

One thing I've seen time and time again with junior developers is that they've not yet internalised the rules of programming (in any language, not even the one they're working in), and are reliant on the computer telling them that they've made a mistake. Having this happen at compile time is better, but even a runtime exception (like in Java or C#) is an enormous help, since it means you get feedback that you've written something illegal.

In this context, C's thing of "if it's UB, the computer can silently do the wrong thing" is really bad for a developer's education, since the computer will often appear to work even though the developer has done the wrong thing (buffer overflow, use-after-free). Rust's move to "in order to even have UB, you need the unsafe keyword" means that junior developers know to stay away from potential UB, and thus avoid the C problem, since it's obvious to them that they're potentially making a mistake.

Rust bandwagon

Posted Jan 10, 2023 19:36 UTC (Tue) by khim (subscriber, #9252) [Link] (1 responses)

This complicates life with junior developers, but they are not the most problematic case.

Look on that whole discussion. Wol is most definitely is not a junior.

It's not easy to educate junior developers, but it's almost impossible to educate senior ones… because often they firmly believe they know in this or that undefined language construct does.

Even if documentation says something else.

Rust bandwagon

Posted Jan 10, 2023 19:46 UTC (Tue) by Wol (subscriber, #4433) [Link]

:-)

(Not helped because C is not my language of choice.)

Cheers,
Wol


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