Hacker News new | ask | show | jobs
by spullara 5030 days ago
My anecdotal evidence agrees with the study. Type inference is also the reason the Scala compiler is so much slower than the Java compiler.
2 comments

Scala has been on the market (i.e. promoted to a broader audience) since 2005 or so. There is plenty of evidence now that Scala is more complex than Java and less suitable for enterprise applications. Despite the fanboy-ism here and on reddit: the Scala hype is over. Definitly.
Having used Scala some myself, I wouldn't be surprised that if we look back in ten years, we have come to the conclusion that Scala is the C++ of modern times. It tries to support relatively opposing paradigms (functional programming - object oriented/imperative programming), has a very extensive type system, and drags in a lot of historical baggage via Java.

I guess everyone has encountered the C++ is 'C with better strings and arrays'-type of programmer who doesn't use RAII or the STL. Or the template-fanatic programmer that wants to drag in template meta-programming into every corner of the project. Or the STL fanatic that wants to replace every for-loop by a function in std::algorithm, even if there is no appropriate fit or it requires building a bunch of stateful function objects (thank god we have closures now). Etc.

If projects do not impose serious restrictions, such a broad language will quickly become an incomprehensible mess.

Being a recovering C++ fanatic myself, I believe more in smaller languages try to solve a particular problem now. For instance, take Prolog, it's a beautiful language for what it is aimed at: logic programming. All the weird object-oriented Prolog experiments have died out by now, and it's a language that you use when you want to solve a particular kind of problem.

Yes. Scala is C++ of the JVM.
Local type inference is not necessarily expensive. Type inference is abundantly used in Go, and yet it's probably one of the fastest compilers.

There are also languages that do Hindley–Milner type inference (ML, Haskell) with good compile times.

I am sure that you can have much cheaper type inference. However, if you turn on the compiler profiler for Scala, you can see that most of the time is spent in type inference. They don't do HM.