News for hackers. Stuff that matters.

Where does the T, U, V convention for generic type params come from?

Java, C#, and TypeScript use T, U, V, etc. to represent generic type parameters. Ostensibly that's because T stands for "Type", and U and V follow T in the alphabet.

On the other hand, Scala uses A, B, C and so on, and OCaml and Haskell use a, b, and c.

Where do these conventions come from? Is it because the functional languages are closer to math proofs, where α, β, and γ are used by convention?

Does anyone know of an early mailing list, commit message, etc. where this convention was discussed?

( 1 comment | 4 points | on HN )
Re:Where does the T, U, V convention for generic type params... by linkula on Thursday June 22, 2017 @05:14AM (#14610993)
I found out some old documentation introducing generics to C# 2.0 (source: https://msdn.microsoft.com/en-us/library/ms379564(v=vs.80).a...) where it is said, that <T> stands for "Type" (as you said in your question).

I also looked at Scala's documentation and found out the following: "Generic classes take a type as a parameter within square brackets []. One convention is to use the letter A as type parameter identifier, though any parameter name may be used." (source: http://docs.scala-lang.org/tutorials/tour/generic-classes.ht...).

Hope it helps.