code

Its all just ones and zeroes isn't it? 
Filed under

2.8

 

Porting code from Scala 2.7.7 to Scala 2.8

We're moving from Scala 2.7.7 to the new Scala 2.8, here are some issues we hit along the way:

  • Referencing types in parent packages
    • In 2.7.7 it seems that the compiler would allow references to types in parent packages, e.g. if I was writing a class in package com.example.data.test, then I could reference types in com.example.data without importing them
    • In Scala 2.8 you have to explicitly import these
    • Makes sense, I wonder if this was a bug in 2.7.7 or a feature?
  • Implicits on companions
    • I'm not 100% sure on this one
    • We have a number of companion objects with implicit conversions on them
    • In 2.7.7 we could use these implicits without explicitly importing them, but in 2.8 we have to import them
  • Missing package scala.collection.jcl
  • Implementing Iterable
    • In 2.7.7 we often implemented iterable like this: new Iterable[Int] { def elements = ... }
    • Instead, in 2.8, you need to write new Iterable[Int] { def iterator = ... }
  • Adding pairs to a ListBuffer
    • In 2.7.7, this code worked:
      • val buf = new ListBuffer[(A,B)]
      • buf += (a, b)
    • In 2.8 it doesn't compile for me, I needed additional parens, e.g.
      • buf += ((a,b))

Filed under  //   2.7.7   2.8   scala  

Comments [0]