It occurs to me that
' have kind of opposite advantages. We can look at it in terms of what things a function signature involves:
&/&mut and elided lifetimes <-> user types and elided lifetimes <-> explicit lifetimes
where the middle case is the one we're trying to find syntax for, and the other two are known quantities. Then
Foo<', T> is consistent with the logic of explicit lifetimes, with respect to what symbol to use and where to put it. Meanwhile,
Foo<&, T> is consistent with the logic of elided signatures with
&mut, with respect to what symbol to use and where elision happens. That is, the existing syntax for elision with
&mut, as well as the syntax extended with
Foo<&, T>, both follow a simple rule: elision happens where there is an
& symbol without a specified lifetime.
In other words, the ampersand
& leads you from elided lifetimes with built-in types (
&mut) to elided lifetimes with user-defined types, while the tick
' leads you from elided lifetimes with user-defined types to explicit lifetimes.
Purely logically speaking I find both of these roughly similarly compelling; the deal-breaker for me is really just that I find
Foo<', T> to be an incredibly big eyesore and
Foo<&, T> merely a normally-sized eyesore.
@mgeisler (and everyone else who liked their comment), what do you think about
Foo<&, T>? Obviously it's not ideal either, but I find it considerably less "lexically offensive" than
Foo<', T>; I'm not sure whether I'm representative.