I want to paint you a picture of a utopia in which Rust has expanded to become
the fabric of the entire classical computing world, where the possibilities of
what we can achieve are not shackled to the decaying dreams of computer science
past. In this perfect utopia you have invented the perfect model for managing
your computer's sci-fi hardware, perfectly free from the legacy of Unix and
Windows. And you need the perfect language to write it in. Everywhere you look
is legacy: C, C++, Java; the stacks get bigger and bigger, cruft all the way
down.
The only shining light is Rust. Those Rustaceans have been chipping away the
cruft, distilling their platform to only the essence of bits and bytes, while
also expanding its expressive power toward legendary elegance. Rust doesn't want
to tell you how to build your system. Rust wants to serve you, to fulfill your
dreams, on your terms. For your ambitions, Rust is the only reasonable choice in
a world filled with compromises.
/u/Gankro's "hacking generativity onto Rust" (section 6.3 here) and bluss's implementation. This is some of the most horrifying code I've ever seen, up there with Duff's device in C and partitioning lists in Python.
Basically, you can use lifetime-based black magic fuckery to move bound checks to compile-time.
Rust: you had my curiosity, but now you have my attention.
From this Reddit comment responding to "What is your favorite Rust code snippet?". It's full of links that I'm too lazy to copy over, but those links make it very informative (and funny).
scott: see, at christmas, if I unwrap() my present and I find that it's empty, I immediately have a panic attack and everyone gets really freaked out. if I expect() a present, at least I can send a stern message before I start panicking in the living room.
scott: sometimes I decide ahead of time that if I start having a panic attack, I'm just going to abort the whole christmas thing entirely and leave
scott: but it's easier to unwind if I don't abort and stick around