Skip to content

@ahoy-jon /gist:3608684
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
trait Page
trait PageData
trait PageOperation {
type P <: Page
}
trait PageComponent {
self: PageOperation =>
protected var page:P = _
protected var pageData:PageData = _
def initialise(page0:P, pageData0:PageData) {
page = page0
pageData = pageData0
}
}
trait AhoyPageOperation extends PageOperation {
type P = AhoyPage
}
class AhoyPage extends Page
object MyPageComponent extends PageComponent with AhoyPageOperation {}
trait PageInfo {
self: PageOperation =>
def page : P
}
trait AhoyPageInfo extends PageInfo with AhoyPageOperation {
def page = new AhoyPage // for the example
}
object MyApp extends App {
MyPageComponent.initialise(new AhoyPage, new PageData {})
//
MyPageComponent.initialise(new MyPageComponent.P, new PageData {})
MyPageComponent.initialise((new AhoyPageInfo {}).page , new PageData{})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.