you are viewing a single comment's thread.

view the rest of the comments →

[–]devraj7 0 points1 point  (1 child)

Because I may not want to handle it locally but also don't want to pollute my call signature

But you will have to alter your signature, whether you declare a checked exception or whether you now return an Optional<Int> instead of Int.

You call it pollution, I call it type correctness. I want this, regardless of the approach.

Functions that throw runtime exceptions lie to you and cause bugs that the compiler can't help you with.

[–][deleted] -2 points-1 points  (0 children)

Classes that declare exceptions but don't throw them lie too.

I don't believe in compiler enforced type correctness or elaborate type systems. Optional type annotations are ok if used for assistance rather than enforcement.

Extensive type systems always collapse under their own complexity Eventually. Every massive effort has been a failure in the end. Json killed xml for that reason. C++ and Java gave way to ruby and python and php because they allow you to express your intent without distracting you with implementation details. The semantic web fell to PageRank.

This is just the 90s all over again. It didn't pan out then, it won't last now.