Swift Delight: Names for Generic Parameters

Part of the Swift Regrets series.

This is about the library and API guidelines, not the core language, but that’s also important when designing a language. The standard library is where people look to pattern their own code.

To be honest, I don’t remember at this point what made us go this direction, but I think it was associated types. Why have Array<T> with typealias Element = T when you can just say Array<Element>?

It’s not perfect; sometimes you get non-nouns (Optional<Wrapped>) or made-up words (UnsafePointer<Pointee>). But I still think this is way better than T and U everywhere, especially when it comes to prose. You’re gonna talk about the “element type” anyway, not “T”.