Scala's version fragility makes the enterprise argument near impossible
lift.la
lift.la
One major cause of the problem seems to be that Scala is stuck with the "precompiled bytecode in JARs" model of software distribution; while this may be appropriate for Java (where core developers go through great pains to maintain compatibility between versions) it seems like a poor fit for Scala. Not only do the core library APIs change between versions, but the conventions used by the compiler to "link" Scala code together are also altered, for good reason.
An alternative distribution mechanism that's more resistant to these kinds of issues might make sense. Even just distributing source code and build files (like, say, Ruby) could be a better solution. Building dependencies might be slow at first, but centralized caching could address this. Another solution might be an intermediate representation (after type-checking and other compiler phases, but before "linking") that gives the Scala compiler the knowledge that's missing from compiled class files.
Even namespace-mangling or class-loader magic could be helpful here. Loading multiple versions of a single dependency should in theory be possible, since OSGi manages it.
Sadly, there seems to be a pretty large investment by the Scala community in the whole Java/Maven/JAR ecosystem. It'd take a concerted effort by many people to create a more robust solution.
Oh, you don't _have_ the source? Well, there's your problem.
A good reminder of what some of us take for granted in our development environments, I guess.
Oh, I don't know about that. Clojure does this; shipping source is default, and shipping bytecode is only done in cases of certain Java interop forms.
But Maven has a notion of "classifiers" that seem to be a good fit for this. I've seen them used to specify things like "this is the JDK 1.4-compatible version", so I wonder why Scala library authors haven't used them to publish the same artifact compiled against multiple versions of Scala.
http://blog.golang.org/2011/04/introducing-gofix.html http://golang.org/cmd/gofix/
Does that make other people feel queasy, or just me? Like, that feels like a really bad idea to me. What happens if the result only mostly works?
Additionally, go exposes the complete AST for the language and a pretty printer as libraries, so you can write your own fixes if you don't trust gofix.
You fix the other parts, or revert to a previous version of your source tree.
Python also has 2to3.
Scala's issue seems to be that even when the API's haven't changed and there is no need for a sourcecode change a compiler change could break you.
Frankly go's problem seems more manageable.
For example in Go on AppEngine you upload the source for your app, and it is built on Google's servers.
In a way Go's source is its 'bytecode' :)
I can live with having to rebuild my stack for a compiler upgrade, if the ecosystem is setup such that rebuilding the stack is a natural and easy thing to do. The problem seems to be that Scala's ecosystem doesn't work like that.
Go, on the other hand, is, in its current stage of development, requiring frequent source-level changes. I consider that much hairier, as it risks altering the actual meaning of the program even without possible compiler bugs (which Go, like every other language, can still have, I don't know why you seem to think Scala's situation there is special).
Given their apparent state, I would accept neither Scala nor Go as production ready in a general sense. That said, Go gets points for not pretending to be such.
One of the points mentioned there is binary compatibility. The Typesafe people are working on it, so hopefully we'll see some improvement over the next year or so.
Can anybody tell me if this would be true to any JVM targeted language, or is it a specific issue of the Scala compiler?
I'm asking because I just recently decided to abort learning Scala in favor of Clojure.
Now, there have been some source-level incompatibilities, especially going from Clojure 1.2 to 1.3, and this seems to have been a bit of a headache within some parts of the Clojure community.
The 1.2 -> 1.3 transition has had a couple of bumps, but nothing compared to the pain I recall from my time across Scala versions years ago. FWIW, I have code I wrote years ago against pre-1.0 Clojure that still sits in jars in my Maven repository that is loaded and run in 1.4 alphas today. Backwards compatibility is mostly quite good.
What AOT really is, is when you first run a java program with certain flags, and some compilation starts, a special AOT version, which is usually a low optimization level which is saved to disk with some relocation markers.
This helps with startup time in subsequent runs as the compiler can just load its baseline pre-compiled classes straight into memory instead of having to do a bunch of grunt work during startup. Once things get going, the compiler can much more quickly work its way up to the higher optimization levels on the sections of code that need it.
THAT is what AOT means from a jitted language perspective.
I think Scala is slowing down in this area, but have not stopped.
Neither Scala or Clojure's compilers generate byte code that is expected to work with that from another version of the respective compiler or with a different version of the language runtime.
In the case of Clojure this is mitigated by the fact that (since it is a dynamic language) that applications and libraries are generally delivered in source form and "ahead of time" compilation is seen as an optimization rather than a code delivery mechanism.
http://codemonkeyism.com/scala-unfit-development/
There are two forces at play here:
a.) Binary fragility of Scala
b.) A community that upgrades libraries (your dependencies) to every new RC candidate - even when only fixing bugs. So if you have a show stopper bug you need to upgrade to the newest RC breaking all your other dependencies.
Either a. and b. would be no major problem, combined it throws you into a dependency hell for days hunting for dependencies that work.
Hope they resolve this issue. People promised a solution in the blog comments, then promised a solution a year later as the issue surfaced again on the #typesafe blog.
I'm just starting to experiment with Scala for scripting on top of existing Java, so the current state is not a hardship for me. The article is helpful in pointing out the task (technical as well as P/R) to be faced by any would-be "golden standard" vendor, though.
Maybe he should switch the language? Looking at Lift's source code/API this is pretty much a abuse of the language.
The code he writes is probably as idiomatic Scala as it can get.
Yet another reason why people should be wary.
We're talking about his level of expertise in Scala, which is probably one of the highest in the community.