Live data from Hacker News

Under the hood: Vec

marma.dev

1–10 of 142 posts

Re: Under the hood: Vec<T>

#6
I love how it shows that you can have both performance and safety without jumping through hoops. The little details of memory management really shape how we end up writing code, often without even noticing. Rust makes it possible to get close to the hardware while still keeping you out of the usual trouble spots. It’s one of those things you appreciate more the longer you use it

Re: Under the hood: Vec<T>

#7
While safe Rust may be relatively simple to write, and certainly easier to write than safe C, this article has someone added to my belief that unsafe Rust is far too difficult to write. Perhaps some of this is deliberate, as a kind of defence mechanism against people using it willy-nilly, it still seems over-designed.

Re: Under the hood: Vec<T>

#8
post #5

related: https://doc.rust-lang.org/nomicon/vec/vec.html

Oh, I never knew that Rust had variance. I always just assumed everything was invariant. Strange that they've got no way to write it down in the type system.

Re: Under the hood: Vec<T>

#9
post #6

I love how it shows that you can have both performance and safety without jumping through hoops. The little details of memory management really shape how we end up writing code, often without even noticing. Rust makes it possible to get close to the hardware while still keeping you out of the usual trouble spots. It’s one of those things you appreciate more the longer you use it

I come from a Swift/Kotlin background and I've been learning Rust for fun in my spare time

From what I heard online I was expecting it to be a lot harder to understand!

The moving/borrowing/stack/heap stuff isn't simple by any means, and I'm sure as I go it will get even harder, but it's just not as daunting as I'd expected

It helps that I love compiler errors and Rust is full of them :D Every error the compiler catches is an error my QA/users don't

Re: Under the hood: Vec<T>

#10
post #7

While safe Rust may be relatively simple to write, and certainly easier to write than safe C, this article has someone added to my belief that unsafe Rust is far too difficult to write. Perhaps some of this is deliberate, as a kind of defence mechanism against people using it willy-nilly, it still seems over-designed.

When I was young I peeked into the C++ stdlib, which is probably the best thing to compare this to. It was orders of magnitude worse.
Post reply on HN