blog dds


A Tiny Review of Scala

Earlier today I finished reading the Programming in Scala book. My review of the book should appear soon in the site and the ACM Computing Reviews. Here I outline briefly my view of the Scala language.

Scala combines with care, pragmatism, and gusto object-oriented and functional programming. Only the most die-hard fanatics would fault its support for functional programming, yet Java programmers will initially feel at ease in the language's object-oriented cocoon. By supporting immutable values and actor syntax Scala may also offer us a way to tame the power of multi-core processors. In general, Scala follows Perlís ďthe language must serve the programmerĒ rather than Adaís ďthe language must discipline the programmerĒ philosophy. As a result although it has 10 fewer keywords than Java and 13 less than C++ Scala feels a bit heavy and difficult to master. Perhaps a small comprehensive quick reference card could help in this regard.

The language is a remarkable improvement over many of its predecessors; itís a language I think worth mastering. I'm particularly impressed by its innovative support for API programming through library-provided domain-specific languages. However, I canít say Iím completely satisfied with Scala. My immediate reservations from reading the book are the following.

  • Itís probably impossible for an average programmer to understand the languageís type system. Consequently, the only way to verify whether a program is correct is to compile it. Although the courageous revolutionary decision to adopt a sophisticated type system may advance the state of the art of programming, my fear is that it will promote a hacking mentality. How else is a programmer supposed to respond to the error message "covariant type T occurs in contravariant position"?
  • Javaís annotations although useful, are clearly an afterthought bolted onto the language. I would have hoped that Scala would integrate them into the language-proper in a graceful manner.
  • I donít think that native support for XML was justified. XML is a lousy format for presenting structured data in a human-readable form, and has no place inside a programís source code. Scalaís DSL capability would be enough to support structured data specifications through a simple library.
  • Scalaís syntax could do with some more ironing to increase orthogonality and consistency. For instance, why do we write
    i <- 1 to 10
    and not
    i in 1 to 10
    i <- 1 ... 10
  • Java did all programmers a favor by doing away with shorthand identifiers. Scalaís mkString method brings us back to the dark ages of Cís strpbrk function.

I've already downloaded the Scala implementation, and I intend to write a substantial project in Scala. After that I hope to have a more comprehensive opinion on it.

Read and post comments    AddThis Social Bookmark Button

Creative Commons License Last modified: Wednesday, July 22, 2009 7:32 pm
Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-Share Alike 3.0 Greece License.