|
Before, this was allowed:
scala> try ( 1 / 0 )
java.lang.ArithmeticException: / by zero
But since the advent of util.Try, the subtle difference to the
following seems dangerous:
scala> import util.Try
import util.Try
scala> Try ( 1 / 0 )
res4: scala.util.Try[Int] = Failure(java.lang.ArithmeticException: / by zero)
Discussion: https://groups.google.com/d/topic/scala-language/fy2vXD_3fF8/discussion
There was some concern that this curtails a handy, temporary
way to remove the exception handlers from some code. But after
thinking about this, I contend that:
a) those people can easily stomach the warning temporarily
(modulo, of course, those with -Xfatal-warnings.)
b) putting this warning behind Xlint will disable it for those
who need it most: beginners.
I also chose not to refer to 'scala.util.Try' in the error message
as I think that has as much potential to confuse as it does to clarify.
|