Skip to content

Instantly share code, notes, and snippets.

@Sciss
Last active December 20, 2015 16:39
Show Gist options
  • Save Sciss/6163479 to your computer and use it in GitHub Desktop.
Save Sciss/6163479 to your computer and use it in GitHub Desktop.
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