Created
June 24, 2014 15:34
-
-
Save 4lex1v/5df4bfd2fd100551f74d to your computer and use it in GitHub Desktop.
Small silly cake
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 Service { | |
def host: String | |
def port: Int | |
} | |
trait GoogleServiceModule extends Service { | |
val host = "google.com" | |
val port = 80 | |
} | |
trait BingServiceModule extends Service { | |
val host = "bing.com" | |
val port = 80 | |
} | |
trait FooModule { | |
type bar <: BarLike | |
trait BarLike { _: Service => | |
def connect = println { | |
s"Connecting to $host:$port" | |
} | |
} | |
} | |
object EndOfAll | |
extends FooModule { | |
object bar | |
extends BarLike | |
with BingServiceModule // or with GoogleServiceModule | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment