Hacker News new | past | comments | ask | show | jobs | submit login

What I'd like to understand better is what idioms are emerging as best practices thanks to the (good!) pressure that Rust puts on us.

For memory management, some of the major algorithms available are global allocation, stack allocation, malloc/free, reference counting, and tracing garbage collection. (The Entity Component System model is doing your own allocation so it's a subtype of either malloc/free or ref counting.)

Stack allocation and global allocation with borrow checking seem very attractive in terms of safety, but you have to know more in advance about how the memory is going to be used because growing the allocation while you are deeper in the stack is not possible. Are there any idioms or algorithms which are particularly friendly to this model? For instance, traversing a preliminary object graph to establish max allocation requirements before allocating a large block on the stack?




> What I'd like to understand better is what idioms are emerging as best practices thanks to the (good!) pressure that Rust puts on us.

We all would. They're still emerging! I think the generational index idea is one of them, though.




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

Search: