Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kmizu
Created August 26, 2011 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmizu/1173542 to your computer and use it in GitHub Desktop.
Save kmizu/1173542 to your computer and use it in GitHub Desktop.
Emulating separate compilation in Scala
//Header file
trait test {
trait A {
def aaa(): Int
def aaa2(): Int
def zzz(): Int
def zzz2(): Int
}
}
//Partial implementation of header.A
//This file can be compiled only if test.scala is compiled
trait testa {header: test =>
trait A extends header.A {
def aaa() = zzz2
def aaa2() = 100
}
}
//Partial implementation of header.A
//This file can be compiled only if test.scala is compiled
trait testz {header: test =>
trait A extends header.A {
def zzz() = aaa2()
def zzz2() = 22
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment