How to solve Scala source incompatibilities in 2.8.0?

There are several cases of source incompatibility with Scala 2.8.0. For example, by creating an anonymous one Seqthat once required a definition of the abstract def elements : Iterator[A], which is now called def iterator : Iterator[A].

For me, the brute force solution is to create two branches that correspond to the different major versions of Scala.

Are there common methods for such code to be compiled on both systems?

// Note: this code resembles techniques used by xml.NodeSeq
trait FooSeq extends Seq[ Foo ] {
   def internal : Seq[ Foo ] 
   def elements = internal.elements
   def iterator = internal.iterator // Only compiles in 2.8
                                    // need to remove for 2.7.X
}
+3
source share
1 answer

, , . - , - 2.7 2.8, . , 2.8 (: , ), :

def iterator = internal.elements

, . VCS, (Git, Bazaar, Mercurial) .

+2

Source: https://habr.com/ru/post/1730382/


All Articles