David Pollack founded Visi.Pro, Cloud Computing for the Rest of Us along with the Visi Language open source project. David founded the Lift Web Framework and continuously contributes to Lift. David has posted 39 posts at DZone. You can read more from them at their website. View Full User Profile

Oy, scalac

  • submit to reddit

I really hate when this happens

I burned most of my productive time on Tuesday with an infinite loop in the Scala compiler. It made me very, very grumpy.

First, you can find the code that reproduces the problem in the Visi repository.

To reproduce the problem, clone the repository, checkout the scala_infinite_loop branch, cd visi/core/scala, type sh sbt11, and in sbt, type compile and then test.

The following lines cause the infinite compiler loop (lines 200-202):

private def lineFeed: Rule0 = rule {
  zeroOrMore(EOL | EOI)

But, if you change the code to:

private def lineFeed: Rule0 = rule {

The code compiles and tests just fine.

Why this is a problem

So, in most computer languages, it's not a problem to have a bug in the compiler... complex systems have complex bugs.

The problems that I see here are:

  1. The problem manifests itself when program B is compiled against program A and the type signatures have not changed between the two code inputs. This is a serious problem.
  2. I cannot change to a different release of the compiler because of Scala's version fragility issue. Yes, I spent more than an hour looking for Scala 2.9.1 and 2.10.0-RC?? versions of the libraries that Visi depends on and the only combination of the libraries I needed were in Scala 2.9.2.
  3. It takes a long time to fix bugs in the compiler like this pattern matching bug that took 4 years to get fixed.

My switching costs are too high

I've spent 6 years learning Scala, writing web frameworks for Scala, writing books about Scala, and bending my brain to code the Scala way. Building a complex system in something that's not Scala is more than I can do right now. My switching costs away from Scala are too high.

Yeah, I know I'm likely to be insulted for pointing out the fact the Scala is not yet ready for prime time, even after 2 years and more than $3M of investment in a commercial Scala company. But, I've been a huge advocate for the value of Scala (it's awesome for small, hot teams like Twitter and Foursquare). It's equally true that if you adopt Scala, many of the benefits to the developers can be destroyed by the bugs, the versioning challenges, the challenges of having legitimate concerns being heard by a community that's steeped in academia, and the value of research over stability.

Choose Scala wisely.

Published at DZone with permission of its author, David Pollak. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Liam Knox replied on Fri, 2013/01/04 - 6:56pm

My first experience of the language is very positive though you still need to question the strategy.  Typesafe seem to be still bundling in more and more features in every release and neglecting basics of tool support and performance in building within in the IDE's available. 

That is not a good strategy if you want to improve your user base. 

Please, Typesafe, timeout. Think about how people actually develop, what they need and the problems they need to solve rather than what you can academically grow in a language.   Very 'neat' languages features add little if I battle a slug of a development environment.

Jesper Nordenberg replied on Thu, 2013/01/10 - 3:56am

Totality and effects checking FTW

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.