Last active
December 20, 2015 16:39
-
-
Save Sciss/6163479 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Sys { | |
type Global | |
} | |
object Settings { | |
def apply(sys: Sys)(glob: sys.Global): Settings { type S = sys.type } = | |
new Settings { | |
type S = sys.type | |
val system: S = sys | |
val global: sys.Global = glob | |
} | |
} | |
trait Settings { | |
type S <: Sys | |
val system: S | |
def global: system.Global | |
} | |
trait Foo[S <: Sys] { foo => | |
val system: S | |
protected var global: system.Global | |
def read(value: Settings { type S = foo.system.type }): Unit = | |
global = value.global | |
} | |
trait Bar[S <: Sys] extends Foo[S] { | |
val test = Settings(system)(???) | |
read(test) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment