Given that the CLR generics implementation supports more features than the JVM's, such as reification, and the JVM's generics are a mere Java "compiler trick", why are higher-kinded types not possible in F# but possible in Scala? Does the CLR generics implementation somehow get in the way of things, whereas the JVM's lack of one allows you to go further than what the designers intended; somewhat like dynamic languages let you do tricks that a strongly-typed compiler would make impossible?
In principle, I'm not sure that there's anything preventing F# from including higher kinded types; the CLR doesn't natively support them, so a more indirect compilation strategy would need to be used, but that's the case for Scala on the JVM too. It may or may not be more complicated to do this on top of the CLR's reified generics, but I suspect the reason that F# doesn't include them is more philosophical. While higher kinded types would be nice, F#'s design tends to favor simple features that interoperate well with other .NET languages; higher kinded types would probably require significant effort to add to the language, would complicate type inference and other parts of the language and would definitely not interop well with C# and other .NET languages, so the costs (including opportunity costs) were probably perceived to outweigh the benefits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With