38 ms·
I assume it's derived from the OCaml generic type syntax (the first Rust compiler was written in OCaml after all), for example the definition of the type `Optio
by needlesslygrim 2y ago
I assume it's derived from the OCaml generic type syntax (the first Rust compiler was written in OCaml after all), for example the definition of the type `Option.t` in OCaml:
type 'a t = 'a option =
| None
| Some of 'a
I think this is the case because IIRC this function:
fn slice<'a>(s: &'a str) -> &'a str { &s[0..2] }
Is generic over the lifetime of `s`, and it I assume it would have been difficult to distinguish generic types and lifetimes.
- steveklabnik 2y agoIt’s related yeah. In Ocaml it’s a generic, and in Rust, lifetimes are also a generic type.
- needlesslygrim 2y agoGood to know, also cool that you replied!