Conversation

It may be more accessible this way: If you have a function `fn x<'a>(&'a Something)` and you call it, the compiler has a concrete lifetime (the one of Something) to check. So it fills in the lifetime parameter through the actual time that Something lives.
1
But in the case of closures and some other things (which may be defined, but called _later_ in a function-like manner), we don't know the lifetime in the scope of the caller yet. So `for<'a>` means "independent of the situation at the call site, this must _always be safe_".
1
1
Hmm just gotta be careful here, forall is not a lambda - it’s the type of a lambda! It gets a bit weird in Rust as they are only used within trait constraints, and you never see the corresponding lifetime functions, nor can you construct them yourself.
1
1
(was meant to be `assert_eq!`) See how `for` lets you write a `fn` type that depends on the type parameter `T` that is applied. Note that this is actually very similar to the `fn` type, just at the type level, and implicit.
2
This would be problematic for monomorphisation however, which is why you can't do it in Rust right now. I.e. depending on the type you apply at runtime you'd need to generate different code for `id`, which is 'difficult'. 😅
1