Hi Martin,
Sorry for not finishing it yet.
These two methods (run & runWith) was intended for fast partial function application in some widespread scenarios, such as method `collect` in scala collections:
def collect[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
val action = pf runWith { y => b += y }
this foreach action
b.result
}
See this post for details:
https://groups.google.com/forum/#!msg/scala-internals/mtMDGik1i1c/jzAostbxW8IJ
It was my proposed extension to PartialFunction interface. However, I did not received much feedback on this, so I really don't have any clue whether such extension is desirable and/or acceptable. Maybe you could refine on this?
As regards to missing ScalaDocs, I'll fix them in a week if these methods will survive at all.
but if (pf.isDefinedAt(x)) someAction(pf(x)) is captured by (pf andThen someAction)(x), right?that's what collect needs, as far as I can tell
Though I'm still reconciling that with:Even if every call to p initiates a new nuclear war,
if (p(x)) f(x)
should either happen or not happen. There is no room in the land of
sane code for a third choice of "or we throw an exception if p changes
its mind when we double check."
Lots of things, most things even, may or may not throw an exception.