Re:Advanced programming languages (2009)
by gaius on Sunday June 19, 2016 @02:16PM
(#11933938)
Once you have had real Hindley-Milner Scala feels painfully primitive. Just go straight to OCaml.
[ Parent
| on HN ]
I'm afraid I disagree. I went from Ocaml to Scala. While full type inference is nice, it's a minor issue in practise, but the vastly bigger library ecosystem that Scala has (due to being a JVM language) isn't. Object orientation also works better in Scala than Ocaml.
Re:Advanced programming languages (2009)
by saosebastiao on Sunday June 19, 2016 @03:39PM
(#11934340)
I'm afraid you have it backwards. Scala's type inference comes at a slight cost (you have to annotate parameters), but it enables a much more powerful type system than even HM allows for.
Or go to F# and enjoy the vast universe of .NET.
To be fair Scala does have access to the Java ecosystem
Can you expand on this for someone who is not familiar with Hindley-Milner typing?
Re:Advanced programming languages (2009)
by premium-concern on Sunday June 19, 2016 @05:21PM
(#11934733)
Hindley-Milner means that you – unlike Scala – don't need to provide any type annotations at all as they can all be inferred.
This comes at a steep price, as HM-inferable typesystems are very limited, and most languages have in fact a typesystem that might be based on what HM can infer, but have extensions that require type annotations.
In the end Scala's requirement to annotate input parameters is not a big deal, as this only enforces what Haskell/Ocaml/... consider to be best practice anyway.
> In the end Scala's requirement to annotate input parameters is not a big deal, as this only enforces what Haskell/Ocaml/... consider to be best practice anyway.
It's a huge deal. I always write type signatures once I know what they are, but a lot of the time I get the compiler to infer them for me which saves significant headaches.