Created
September 3, 2012 11:30
-
-
Save ahoy-jon/3608684 to your computer and use it in GitHub Desktop.
This file contains 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 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