Conversation

Friends learning Rust: writing about lifetimes is something I get requests for a lot, but it's hard for me to know exactly where people are stuck. If you're stuck, can you tell me where? Maybe you're reading the book and some part doesn't click? Ask about it with your words!
20
87
I've had a hunch for ages and even ranted about it once in a while, years ago every time we teach or talk about named lifetimes as if they're not *generic parameters*, we make muddle the waters like pretending <'a> is coincidental syntax reuse and not the same as <T>
3
16
another lie is "concrete lifetime". there really isn't such a thing, especially not with NLL other than I guess 'static everything is parameters and threading relationships through data structures and function signatures
2
8
that's... intentional. you'd need much more complexity in what you can describe in signatures to be able to handle all of the intra-function situations borrowing only a subset of fields, or even with separate borrows, is the biggest thing AFAIK
1
I guess one thing I wish for is `fn foo() -> exists<'a> Bar<'a>`, which can be pretty handy for testing. But yeah, I guess in the general case it could definitely get mighty complicated…