I've recently found myself researching the Rust programming language.
Professionally I'm a system-level programmer with decades of experience. I'm unafraid of pointers, assembly, or math.
So far it looks fine. Package managers always worry me, but ok. Am I missing any gotchas?
Conversation
Don’t try to write recursive data structures, it’s not worth it. Also don’t even try to do inheritance, you want composition instead
2
1
Why don’t you want to write recursive data structures? (I don’t know rust very well)
1
Can get fun with stack allocation-by default (need to introduce pointer indirections to avoid infinitely sized datatypes). And if you need to introduce cycles you’ll need to use an allocator that’s aware of this, index-based handles, or weak references.
At worst can't you just do what Haskell/OCaml do and box everything and then dynamically allocate as necessary?
2
Yeah, that’s what I do. It’s a bit more clunky though, especially for pattern matching (this doesn’t yet work through smart pointers, sadly).
2



