September 17, 2011, 18:09
In my scala explorations I also came across the problem of testing and verifying mocks. In scala it is trivial to pass around predicates, however these are function objects, that can be applied, but don’t know much about their implementation. So while the code is readable the feedback can be quite bad.
Groovy’s assert statement is a shining example, how both goals can be attainded. Just consider the following assertion:
assert ["100","Test", 11].contains("10"+"1")
It is beautiful to read (as opposed let’s say hamcrast that makes me use it’s own syntax to construct an expression tree). When it comes to execute this I also do get really good feedback:

September 4, 2011, 14:41
Recently I have been dabbling with scala a bit. As it happens I found a few quirks in the compiler.
So does the following bit of code compiler and, if so, what does it print?
object Example {
val x = y
val y = true
def main(args: Array[String]) {
print(x);
}
}
Yes you’ll get false and that is plain wrong. In my opinion a compiler error would have been fine and ideally, as there are no cycles it would have just printed true.
Another major selling point of scala is it’s pattern matching mechanism. A very convenient feature is the compiler’s ability to print a warning, if the cases provided are not exhaustive. A very simple case of such a non-exhaustive match is this:
object CaseExample {
def main(args: Array[String]) {
val b = args.length == 1
b match {
case true => print("True")
}
}
}
Unfortunately the compiler doesn’t complain at all. After some googling I came across SI-3111. My own problem was slighty, but only slightly more complicated. I matched tupels of Options against Some and None.
We have been bitten by both problems, that lead to really subtle bugs. This is really unfortunate, because the compiler can do a lot more in a language like scala. The first problem gets even caught by javac.
A third shortcoming of scala can be easily fixed. Set the tab size to four spaces and your code will
look a lot more structured.
To me it seems like the scala compiler unnessarily discredits the idea of strong static checks by a somehwat quirky implementation.