Blog: Rust sucks... (not)


Wherein wie fail to build a simple data structure safely, but that’s OK anyway.


I generally agree with the sentiment of your post, and while I’m fairly new to Rust myself, I can see why the “I cannot write an X datastructure” statements come up. To start, this tends to be a learning exercise that people use to familiarize themselves with a language. Second, Rust makes it harder to get something to compile; this part is actually good, but for newcomers sometimes getting the thing to run, even if it’s not robust enough, is a good sense of accomplishment, and enough for them to keep learning. To be clear, I like that Rust is more strict and frontloaded, but I can see the flipside for newbies. Third, unsafe Rust is always talked about like a leper - most docs actively try to steer you away. Again, that’s good but it makes reaching for unsafe seem like you’re doing something dirty. Fourth, for a systems level language, low level tinkering isn’t uncommon and building custom tailored data structures isn’t either.

Mostly, I think that perhaps unsafe Rust shouldn’t be shied away from as much, and perhaps even encouraged in some situations. So it should be last resort, but not a bad resort (necessarily), or at least not feel like one.


I just gave a three days course for Rust and opted for introducing unsafe as fundamental. I don’t even think it’s a last resort.

People took that well, as long as you explain how to wrap unsafety properly along with it.


This is a good point: perfect is the enemy of good. It’s why I quit trying to work with Haskell.