Hacker News new | past | comments | ask | show | jobs | submit login

The Scala hype, if there ever was one, started because for a long while Scala was the only high-performance alternative to Java on the JVM. Groovy was too slow, and many people prefer static typing. But then a large gap started to emerge between what most Scala users needed (and the reasons they turned to Scala in the first place) and what the language designers decided to give them. There were all sorts of funny operators and then implicits, meant to support DSLs. Then came all sorts of nifty tricks like type constructors, whose purpose, I think, was to simply prove that it's possible to build a statically typed language that has inheritence, yet does not require casting, ever. That is, if you're willing to put in the time to learn the intricacies of the type system. Well, they've proven it's possible alright. It is truly a great achievement in PL research, only it came at the price of making the language more annoying with each release. Who cares if you need to cast now and then if it makes the type system simpler and compilation times shorter? Now there are other alternatives. For those wishing to see the light of a new, better, way to program modern machines there's Clojure. For the more timid of heart, Kotlin has been/is being released. It is everything Scala's original users wanted from the language.



I think your warnings about complexity in the type system are prudent, but your comment about casting is off. Casting (with the exception of primitive types) is a very blunt hammer to bash your way out of a type system. The MLs have a simple type system, yet you almost never need to cast. It's worthwhile from a language design perspective to try to eliminate the need to cast entirely, and I believe you don't have to complicate your type system to do so.

Also, you note that "many people prefer static typing", but then you suggest Clojure...


Well, avoiding casts AND supporting inheritance AND having a simple type system is pretty hard. You can usually just pick two of the three.

Many prefer static typing, and many don't. BTW, Clojure is indeed dynamically typed, but it has a "type philosophy" that keeps things nice and orderly, namely no encapsulation and uniform data access.


Java avoids casts in most cases with generics, it supports inheritance, and it has a simple type system. Ditto with C#. (I also haven't heard people complain about the complexity of F#'s type system, so I'd point to it, but I don't know F# enough to be able to say whether it's a good point or bad point in the space here.) OCaml also supports inheritance, although its object system is kinda weird (in that it doesn't really fit with the rest of the language; I wouldn't say it's overly complex though).

Basically I don't think that Scala's complexity should burn us on type safety in general. I think Go and Dart, for example, are an overreaction to the complexities of type systems like those of Scala (no generics and null pointers in the former, and unsound covariant generics and null pointers in the latter). There is room for a statically typed language that brings the benefits of type safety that make programming easier without the complexities that make programming harder; the fact that we haven't found that sweet spot yet doesn't mean that we should just throw up our hands. I'm not convinced that the sweet spot is either unsound or requires casts.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: