Scala Listener/Observer
问题 Typically, in Java, when I've got an object who's providing some sort of notification to other objects, I'll employ the Listener/Observer pattern. Is there a more Scala-like way to do this? Should I be using this pattern in Scala, or is there something else baked into the language I should be taking advantage of? 回答1: You can still accumulate a list of callbacks, but you can just make them functions instead of having to come up with yet another single method interface. e.g. case class MyEvent