Re: Contracted exceptions for Ada
- From: Robert A Duff <bobduff@xxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 09 Dec 2007 17:09:53 -0500
"Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx> writes:
No problem. Exception contracts should be inheritable. File open would say
"I raise this and that and also anything disk driver does." (I remember
Robert Duff proposed that once.)
I think what I proposed was more like what you say below:
what about
call-back routines (think Process in the Containers library); and so on.
Conditional contracts: container's Forall is exception E free if Process
is.
Right -- an iterator needs to be able to say "I can raise anything
raised by the loop-body procedure that is passed in to me."
That's one thing missing from Java, which makes exception
contracts more painful than they need to be. Passing a procedure to an
iterator causes the compiler to lose useful information.
I think preconditions could help a lot in this general area -- instead
of saying "I might raise Divide_By_Zero" on the divide procedure, one
can specify exactly what circumstances cause that exception --
Divide_By_Zero will be raised if and only if you try to divide by zero.
Then if at the call site, you divide by X, and X is Positive, there's
no need for a handler. Unfortunately, there's no Non_Zero subtype.
- Bob
.
- Follow-Ups:
- Re: Contracted exceptions for Ada
- From: Stefan Lucks
- Re: Contracted exceptions for Ada
- References:
- Exceptions
- From: shaunpatterson
- Re: Exceptions
- From: tmoran
- Re: Exceptions
- From: Dmitry A. Kazakov
- Re: Exceptions
- From: Randy Brukardt
- Contracted exceptions for Ada (was: Exceptions)
- From: Dmitry A. Kazakov
- Exceptions
- Prev by Date: Re: Exceptions
- Next by Date: Re: Exceptions
- Previous by thread: Re: Contracted exceptions for Ada
- Next by thread: Re: Contracted exceptions for Ada
- Index(es):
Relevant Pages
|