Hacker News new | ask | show | jobs
by 59nadir 1125 days ago
> Tangentially related, I'd to dabble in Rust at some point but the syntax and memory management leave me trepidatious [...]

Assuming your trepidation is because memory management is somehow more manual in Rust I would argue that it's actually not. This isn't something I'm saying because I want to convince you to use Rust; I'm actually of the opinion that Rust doesn't give you enough direct control of memory allocation and has iffy support for custom allocators on top.

Rust's memory management is much more like a garbage collected language in practice, hence why I consider it too indirect.

1 comments

From the bits of Rust code I've seen, it seems like while memory management isn't exactly manual, it needs to be given a fair amount of thought, what with borrow semantics and such. When writing Swift I very infrequently have to give it any thought at all, beyond avoiding retain cycles (which is usually as simple as using weak references to self in closures).
There's no obligation to pass everything in references. You can wrap most things in Box/Rc/Arc and move on with your life.
But why bother using Rust then?

If you are going to use it like a garbage collected language, you would be better served by one of the slew of other languages with the same features but which are easier to use. The memory management is what sets Rust apart.