Skip to content

Instantly share code, notes, and snippets.

@Sciss
Forked from anonymous/FBoundedSimplification.scala
Last active December 10, 2015 20:28
Show Gist options
  • Save Sciss/4488722 to your computer and use it in GitHub Desktop.
Save Sciss/4488722 to your computer and use it in GitHub Desktop.
// does this work out?
trait Txn[S <: Sys] {
def newVar[A](init: A): S#Vr[A]
}
trait Var[Tx, A] {
def get(implicit tx: Tx): A
def set(value: A)(implicit tx: Tx): Unit
}
trait Sys {
type S = this.type // ! yes ??
type Tx <: Txn[S]
type Vr[A] <: Var[S#Tx, A]
}
// nope...
trait Txn[S <: Sys] {
def newVar[A](init: A): S#Vr[A]
}
trait Var[Tx, A] {
def get(implicit tx: Tx): A
def set(value: A)(implicit tx: Tx): Unit
}
trait Identifier[Tx] {
def dispose()(implicit tx: Tx): Unit
}
trait Sys {
type S = this.type
type Tx <: Txn[S]
type Vr[A] <: Var[S#Tx, A]
type ID <: Identifier[S#Tx]
}
trait Identifiable[+ID] { def id: ID }
trait Test[S <: Sys] extends Identifiable[S#ID] {
def dispose()(implicit tx: S#Tx) {
id.dispose() // !Fail!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment