3 ms·
I really don’t like usage of ‘ in the function signature, it simply looks wrong. In generally that is my main complaint as I am trying to learn Rust, the synta
by mrweasel 6y ago
I really don’t like usage of ‘ in the function signature, it simply looks wrong.
In generally that is my main complaint as I am trying to learn Rust, the syntax seems to be all over the place. Maybe that feeling will fade away as I get more use to the language.
- steveklabnik 6y agoAlmost none of it is unique to Rust, but it does draw inspiration from a wide variety of influences, so it can feel like that for sure. This syntax was taken from OCaml. Incidentally, nobody really loves it, but nobody could come up with anything clearly better either.
- dagmx 6y agoIn most cases you don't need to specify lifetimes. The compiler is smart enough to infer it for a lot of cases. As noted elsewhere by Steve, it's not even required for this signature.
- ashish01 6y agoI also used to feel the same way. But listening to [0]Crust of Rust: Lifetime Annotations by Jon Gjengset helped me understand its need. [0] https://www.youtube.com/watch?v=rAl-9HwD858 https://www.youtube.com/watch?v=rAl-9HwD858 really helped me understand it.
- ragnese 6y agoIf that's your main complaint, then good for Rust!