diff options
author | Paul Phillips <paulp@improving.org> | 2011-10-19 21:31:55 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-10-19 21:31:55 +0000 |
commit | 5fb68614da51c601e354d13ae123820b355594d0 (patch) | |
tree | 62366806e8678628d1cedede056cf8c3719fb62a /src/actors/scala/actors/Future.scala | |
parent | 8337964e312849e5a904b3cfbfa1def0cf180a05 (diff) | |
download | scala-5fb68614da51c601e354d13ae123820b355594d0.tar.gz scala-5fb68614da51c601e354d13ae123820b355594d0.tar.bz2 scala-5fb68614da51c601e354d13ae123820b355594d0.zip |
AbstractPartialFunction.
Contributed by Todd Vierling with minor mods by extempore. This is an
obvious extension of AbstractFunctionN which I had some issue making
work at the time. Sounds kind of pitiful given that the compiler patch
is about two lines, but let's all agree to believe it was a different
world then.
This example program is impacted as follows:
class A {
def f: PartialFunction[Any, Int] = { case x: String => 1 }
def g: PartialFunction[Any, Int] = f orElse { case x: List[_] => 2 }
def h: PartialFunction[Any, Int] = g orElse { case x: Set[_] => 3 }
}
Before: 34943 bytes of bytecode
After: 4217 bytes of bytecode
A mere 88% reduction in size. "'Tis but a trifle!" Closes SI-5096,
SI-5097.
Diffstat (limited to 'src/actors/scala/actors/Future.scala')
-rw-r--r-- | src/actors/scala/actors/Future.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala index 735c13190b..4de73507fb 100644 --- a/src/actors/scala/actors/Future.scala +++ b/src/actors/scala/actors/Future.scala @@ -200,7 +200,7 @@ object Futures { Actor.timer.schedule(timerTask, timeout) def awaitWith(partFuns: Seq[PartialFunction[Any, Pair[Int, Any]]]) { - val reaction: PartialFunction[Any, Unit] = new PartialFunction[Any, Unit] { + val reaction: PartialFunction[Any, Unit] = new scala.runtime.AbstractPartialFunction[Any, Unit] { def isDefinedAt(msg: Any) = msg match { case TIMEOUT => true case _ => partFuns exists (_ isDefinedAt msg) |