|
|
Subscribe / Log in / New account

Huang: Rust: A Critical Retrospective

Huang: Rust: A Critical Retrospective

Posted May 24, 2022 21:26 UTC (Tue) by kleptog (subscriber, #1183)
In reply to: Huang: Rust: A Critical Retrospective by jmalcolm
Parent article: Huang: Rust: A Critical Retrospective

I got triggered a bit on this line:

> Q: Why ARC (automatic reference counting) instead of a borrow checker?

> ARC allows the language to feel lightweight without constantly asking the user to make decisions about memory management.

I'm of the opinion that if you don't know where your data lives and how long it lives, it's going to bite you in the ass. Yes, it's a bit of a pain that Rust is pretty strict about it, but I believe it makes you a better programmer and you get better programs.

Lazy memory management has its uses (see Python and other scripting languages for example) but they're writing an OS here.

Also, integrating reference counting into code written in other languages is tricky, I'm curious how they plan to handle that. Turning everything into a shared_ptr would work I suppose.


to post comments

Huang: Rust: A Critical Retrospective

Posted May 24, 2022 21:40 UTC (Tue) by khim (subscriber, #9252) [Link]

> Yes, it's a bit of a pain that Rust is pretty strict about it, but I believe it makes you a better programmer and you get better programs.

Rust gives you optional reference counting and you can even build your whole program on top of Arc links. If you are not clever enough to use other tools and if you don't plan to squeeze every last drop of performance out of your code.

But it's visible in the code. And it doesn't feel “lightweight” because ARC is not lightweight. People did measurements and Swift is much slower than Rust or C++ for many code patterns because of ARC.

Sure, if you want to attract developers who are accustomed to C# or Java then ARC may be a good choice, but if you are doing low-level stuff then ARC use has to be explicit.

> Also, integrating reference counting into code written in other languages is tricky, I'm curious how they plan to handle that.

That part is fine. ARC is local, it's not like tracing GC which insists on violation of any and all good engineering principles to solve problem which doesn't exist.


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