From this question: What is a higher kinded type in Scala?, I understand what is higher-order types(also first-order type and proper type).
But there is still a question: What's the relation between generics and "higher-order types"?
I know Java supports generics, which is like the first-order type in Scala.
Which of the following are correct?
- In Scala, only the
first-order typeisgenerics - In Scala,
first-orderandhigher-ordertypes are both belong togenerics - In Java, the
genericsjust meanfirst-ordertype, it's not complete genericsis a common term means we can "abstract" on types, no matterfirst-orderorhigher-order
I'd say (1.) is wrong. I'm not sure about (3.) because I'm a bit out of practice concerning Java. But I'd say (4.) is pretty accurate and somewhat similar to (2.).
As far as I know, the term generics refers just to the usage of type parameters. It applies to both first-order and higher-order types or functions.
Offtopic (and somewhat nerdish): Does anyone else see a hidden reference to Wing Commander in (2.)