What it a "τ_0_0"?

I was looking at the documentation for LazyFilterCollection and came across τ_0_0 in its definition of last. What is it? Is there a technical reason why it’s not just Base.Element? as first is?

The compiler converts generic parameters into the format τ_{DepthOfParameter}_{ParameterIndex} (IIRC: it could be reversed) so τ_0_0 means the first generic parameter at top level. eg. the T in Foo<T>.

But these should not appear in documentation.

4 Likes

Looks like an artifact of documentation generation process. Raised a JIRA for it: https://bugs.swift.org/browse/SR-6930

Interesting! I assume the choice of "τ" comes from type theory convention that I'm just too ignorant to know about?

Thanks, I wasn't sure if it was a bug and didn't want to file spurious reports for it.

If my understanding is correct, the term we are looking for to describe it is this: De Bruijn index - Wikipedia

1 Like

The funny part is that at one point in time, T was used instead of tau. Since interface types and other types all used T, it was impossible to read, so @Joe_Groff changed it IIRC.