Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree. The point where I'm not totally convinced on Rust's model is when it comes to lifetime semantics.

People talk about the problems colored functions when it comes to async, but in my experience the real issue you run into with Rust is that once you need to introduce an explicit lifetime into a data structure, the complexity of everything touching it starts to balloon out of control.

This creates all kinds of complications, creates problems with automatically deriving the future trait, and leads to workarounds where people end up passing id's around everywhere instead of references in a lot of cases, which can effectively be a way of circumventing the borrow checker.

I don't know what the answer is, but sometimes Rust feels like it's an abstraction or two away from really solving the problems it wants to solve in an elegant way.



> I don't know what the answer is, but sometimes Rust feels like it's an abstraction or two away from really solving the problems it wants to solve in an elegant way.

I feel like it's not unreasonable to say that some parts of rust are impressive because they make hard things ergonomic, and others - so far - are mostly impressive because they make really hard things possible at all.

Or: I share your intuition, but assuming there even -is- an answer, I think at the very least rust has provided a great service in figuring out what the right questions are.


> people end up passing id's around everywhere instead of references

Well, a reference (or a pointer) is just an index into a giant global and mutable array of bytes, which is pretty crazy!

Passing around indexes into specific arrays of objects is a lot less crazy. The indices are stable even when you reallocate the array, for example. Think of them as offsets, rather than pointers.


Yeah for me it's more around the ergonomics (and imprecision) about using indexes.

It's a perfectly workable approach, but passing around offsets feels like I'm breaking the contract a bit. The compiler doesn't know which index goes with which data structure, I'm just asking the compiler to trust me that I'm pairing them correctly.

Also it tends to be more boilerplate than just having a direct pointer stored inside the data structure.

Don't get me wrong, I understand all the problems with pointers, but it the UX is better in a lot of cases.


Indices don’t need to be imprecise. In Rust at least you can give different types for different indices, so that you cannot mix them up.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: