2 ms·
> re-use data structures That's funny. I've been going mostly the other direction. I'm avoiding mutable structures whenever possible. I have a much easier time
by criddell 4y ago
> re-use data structures
That's funny. I've been going mostly the other direction. I'm avoiding mutable structures whenever possible. I have a much easier time reasoning about stuff when I know that things aren't going to change mid-life.
- galangalalgol 4y agoThat is certainly true, but if you are talking about things that are too big to stack allocate, the cognitive overhead of reusing heap allocated items is the price for getting back the throughput overhead of memory allocation.
- ZephyrBlu 4y agoI don't know what you're programming, but it's pretty hard to not use more complex structures like Vecs and HashMaps without them being mutable. Also, that is exactly what Rust's borrow-checker is there for. It doesn't allow you to mutably borrow the same data structure multiple times.
- criddell 4y agoI was thinking more about the things being contained rather than the containers themselves. But you're right - they are all data structures.