Why are lifetime explicit?

I'd say that unbounded lifetimes are the main example of this, where the most cautious programmers will go as far as defining ad-hoc functions in situ just to keep those lifetimes in check :smile:

A counter-example, however, is how the Rust trait solver currently struggles with some higher-order signatures.

  • Here is a Playground demo where you can see how the zero-cost abstraction cannot be described with generics, requiring either this "late monomorphization template-like pass" that macros are, or heap-allocated dynamic-dispatch type erasure :disappointed:
2 Likes