diff options
author | Pavel Pavlov <pavel.e.pavlov@gmail.com> | 2012-01-16 07:57:09 +0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-03-30 09:19:03 +0200 |
commit | 66b47e1a8c11196d648ed5a98f934a1c65203a65 (patch) | |
tree | 69d808bc33be23f35ffc06755bce492a5463f779 /test/files/presentation | |
parent | 71392585dc56950287135ac2582b516d7971bfbc (diff) | |
download | scala-66b47e1a8c11196d648ed5a98f934a1c65203a65.tar.gz scala-66b47e1a8c11196d648ed5a98f934a1c65203a65.tar.bz2 scala-66b47e1a8c11196d648ed5a98f934a1c65203a65.zip |
a fast, functional PartialFunction implementation
runtime.AbstractPartialFunction provides a default implementation
for the new-style partial function. In principle this class is only
subclassed by compiler-generated partial functions arising from matches.
Either
- the apply method (old-style partialfun) or
- the applyOrElse method (current scheme)
must be overridden, and the isDefinedAt method implemented.
The applyOrElse method implementation is provided to ease the
transition from the old scheme, since starr still generates
old-style PartialFunctions, but locker's library has the
new AbstractPartialFunction.
Thus, this implementation is intended as a drop-in replacement for the
old partial function, and does not require changes to the compiler.
(compiler patches, both for old and new-style pattern matching, follow)
- runtime.AbstractPartialFunction is based on PartialFunction.WithDefault
Original version of FunctionWithDefault by Odersky
(http://article.gmane.org/gmane.comp.lang.scala.internals/4032)
- better performance for OrElse#applyOrElse, OrElse#lift, PF.cond
- new combinator methods: PF#run, PF#runWith, PF.apply
authored by @pavelpavlov, refactored by @adriaanm, review by @paulp
Diffstat (limited to 'test/files/presentation')
0 files changed, 0 insertions, 0 deletions