Gill Bates
Gill Bates

Reputation: 15147

Is there something similar to Java's checked exceptions in Ada language?

Java forces programmer to explicitly specify exceptions raised by methods or provide handlers for them. Is there something similar in Ada language?

Upvotes: 1

Views: 190

Answers (2)

Luke A. Guest
Luke A. Guest

Reputation: 594

The only way to do this in Ada is to write a tool to do it for you, see ASIS and libadalang.

Upvotes: 0

Jacob Sparre Andersen
Jacob Sparre Andersen

Reputation: 6611

Ada does not have exception contracts. The ARG has considered it, and - so far - decided that it isn't worth the effort (AI12-0017-1).

I've seen some cases recently, where it looks like it would be worth the effort.

SPARK (a provable subset/superset of Ada) prevents exceptions completely, so that is an option, but it isn't always feasible to prove absence of all exceptions completely.

Upvotes: 6

Related Questions