One thing that comes to mind is to do something like this:
trait ClockActor { def pf:PartialFunction[String, Boolean] = { case "a" => true case v if(_pf.isDefinedAt(v)) => _pf.apply(v) } def _pf:PartialFunction[String, Boolean] = Map.empty } object MasterClock extends ClockActor { override def _pf:PartialFunction[String, Boolean] = { case "b" => false } println(pf("a")) println(pf("b")) }
which will output:
scala> MasterClock true false
The value true comes from the definition in the partial function Trait ClockActor , false comes from the Object MasterClock .
source share