3 ms·
I had the same reaction initially, but I found it a lot more palatable when I realized that the lifetime notation was taken directly from the ML family of progr
by portmanteaufu 13y ago
I had the same reaction initially, but I found it a lot more palatable when I realized that the lifetime notation was taken directly from the ML family of programming languages.
For an example, see the Queue data structure snippet here: http://en.wikipedia.org/wiki/Standard_ML#Module_system http://en.wikipedia.org/wiki/Standard_ML#Module_system
A lot of Rust's little syntactic foibles are actually borrowed from whatever language might've inspired the feature. I've had some fun on Google trying to unearth their inspirations.
- saosebastiao 13y agoI find it heartening that Rust has drawn inspiration from so many different languages and paradigms. It seems to be the ultimate "Not a <insert religious paradigm here> language". My own learning trajectory never introduced me to object orientation until about a year ago (I basically learned how to program by using fairly domain-specific functional and declarative languages), and Rust blew me away at the power of object oriented code. But then I tried learning Java and was equally blown away at how aggravating a pure object-oriented approach can be...almost as frustrating as it was to learn Haskell. I'm glad that there are pragmatic geniuses out there designing pragmatic languages like Rust.
- kenko 13y agoThat's not using the ' for anything like Rust's lifetimes, though; "'a" is just how you refer to some not-further-specified type in ML. A function to reverse a list is polymorphic in what the list contains, for instance, so it would have the type 'a list -> 'a list.
- portmanteaufu 13y agoOh, my mistake! Thanks for clarifying.