I've spent three work days trying to build Akka with range positions
turned on, and I can't justify spending more time on that right now.
This email is a summary for anyone who picks it up from where I got.
If you try, be aware that you need to get a very recent build of SBT;
until yesterday, due to the way the RangePositions trait works,
-Yrangepos wouldn't do anything.
Using such a recent build of SBT, I got one crasher in Akka that turns
out to already be fixed in Scala's master. Here's that patch:
https://github.com/scala/scala/commit/120e14fadf30b4c39f953832108d19b736dc6f2d
If it's not too late, the above patch might be a good candidate for
cherry picking into 2.10.0. It's a small and safe patch, and it
prevents a compiler crash.
That patch is not enough to build Akka, however. With that patch in, I
still get two more crashers, both of them involving synthetic methods
of case classes: one for readResolve, one for unapply. Those two still
need to be fixed, and possibly other things as well.
Going forward, I would propose consideration of phasing out -Yrangepos
and developing a single unified position implementation that does
ranges. Despite the -Y on the option, it's not really optional any
more, is it? The IDE can't be crashing! Yet, as things stand, range
positions don't get exercised as much as they should, and so they are
eternally fragile. In general, options are bad; whenever you can make
a non-optional version that is 90% as good, it's usually a good
tradeoff. Options mean an ongoing complexity in the tool and an
ongoing burden for regression testing.
My fellow Scalists, we can do this. Our compiler can do the cake
pattern, dependent methods, user-supplied pattern matchers, and
type-directed macro expansion.... but ask it to compute range
positions, and it collapses into a gibbering transporter accident?
I've got to think that a unified position implementation would be
straightforward to get working and get stable. Moreover, there are a
number of ways to improve the memory usage of range positions, and
some of them are easier with a unified implementation.
Just a thought. Anyway I thought folks would like to know what I found.
Lex Spoon