|
|
|
|
|
by marketer
6793 days ago
|
|
For a while, they called Scala the ocaml-killer. Because it is fully interoperable with Java, it enjoys a huge standard library, which is one of the main pitfalls when writing ocaml code. I'm not sure it ever really caught on, though. Scala is a nice functional language with a rich type system built on java byte code, and is similar in concept to Microsoft's offering on the .NET platform: F# |
|
I think the comparison to F#/ocaml is only skin-deep. Scala does have type inference, which saves a lot of typing compared to Java. For example, in Java one might write:
In Scala one can get away with: The parens are optional. There as no type declaration for "factory", yet the language is still strongly typed, so the type of "factory" is inferred at compile-time. In many ways Scala code "feels" like Ruby (in the brevity and expressivity of its syntax), but strong type-checking means you avoid bugs (at compile-time) that in Ruby you'd have to catch with extensive unit tests or total system failure every now and then.Scala also has a sophisticated Actor library based on Erlang's actors. Scala's extensible syntax means that the following is valid Scala code (and was implemented as a -library-, it's not part of the language specification).
Actors are lightweight, so you can spawn hundreds of thousands of them on a single JVM, yet (unlike Ruby) they run on top of system threads, so you get real concurrency. This is unbelievably awesome for web development. Imagine keeping an actor thread alive for every logged in user to your site. Combine this with Ajax/Comet and you can "push" any updates out to the user as they become available.Anyway, I'll stop raving, but check out Scala by Example (link elsewhere in the comments) and the lift web framework written in Scala (link elsewhere in the comments).