On 6/12/13 6:49 PM, bearophile wrote:
Ary Borenszweig:

Maybe checked exceptions are bad only for the type system of Java. Maybe
for a language that has global type inferencing on the exceptions such
feature becomes better.

Why?

I am not an expert of type systems, so this is this just an hypothesis.
What are the disadvantages of checked exceptions? One problem is that
those annotations are heavy, make the code rigid to change, and this
doesn't go well with normal programmer laziness. A global type
inferencer (that doesn't work well with the dynamic nature of Java)
avoids the need for all exception annotations, but forces you to catch
exceptions somewhere, assuring no holes remain if you don't want holes.

Bye,
bearophile

But if a type checker deduces a function foo throws exception A, and in function bar you call foo: are you forced to handle the exception? If not, do you have to tell the compiler that you don't want to handle that exception? Isn't that the same as what Java does?

Reply via email to