scala 2.8 control Exception - what is the point?

Viewed 3960

In the upcoming scala 2.8, a util.control package has been added which includes a break library and a construct for handling exceptions so that code which looks like:

type NFE = NumberFormatException
val arg = "1"
val maybeInt = try { Some(arg.toInt) } catch { case e: NFE => None }

Can be replaced with code like:

import util.control.Exception._
val maybeInt = catching(classOf[NFE]) opt arg.toInt

My question is why? What does this add to the language other than providing another (and radically different) way to express the same thing? Is there anything which can be expressed using the new control but not via try-catch? Is it a DSL supposed to make exception-handling in Scala look like some other language (and if so, which one)?

3 Answers
Related