by cranej · 7y ago · 0 comments
Example:
struct HReq<'a> {
}
struct HReq<a: LifeTime> {
}
Isn't that better?It’s not a language level constraint to name lifetimes with a single letter. But folks tend to not use longer names for good reason.
Rust is in a weird spot because we have two different kinds of generic parameters: types and lifetimes. They need to be distinguished from one another somehow. Nobody loves the lifetime syntax, but nobody has ever proposed something that would end up significantly better.
I’m not proposing you should use ‘a_lifetime, I’m saying you could. In the end, it ends up obscuring more than helping.