From: "Peter C. Chapin" <pcc482719@gmail.com>
Subject: Exception contracts for Ada? Was: Re: Press Release - Ada 2012 Language Standard Approved by ISO
Date: Mon, 24 Dec 2012 10:49:39 -0500
Date: 2012-12-24T10:49:39-05:00 [thread overview]
Message-ID: <46idnVdMEr8J5EXN4p2dnAA@giganews.com> (raw)
In-Reply-To: <op.wptir6egule2fv@cardamome>
On 12/24/2012 06:13 AM, Yannick Duchêne (Hibou57) wrote:
> This one is fine, I see your point now.
Exception contracts are a huge, HUGE topic and one that shouldn't be
treated too lightly. I can understand their attraction in a language
that prides itself on its suitability for robust programming. However,
if exception contracts are ever added to Ada I pray to the Ada gods (the
ARG?) that it is only done after an extensive review has been made of
the issues related to them in other languages. One only needs to search
for the topic of exception specifications in C++ and Java to find a
mountain of discussion on the subject. Consider:
+ Should exception contracts be enforced statically or dynamically?
+ Should exception contracts be enforced at all or only produce warnings
or logs?
+ What about backward compatibility with the existing code base? We
don't want to force people to decorate all code with exception contracts
before it will compile again with Ada 2020 (or whatever). Do we?
+ Should exception contracts distinguish between "impossible" exceptions
that shouldn't occur in a correct program (like Constraint_Error) and
"normal" exceptions that pertain to environmental problems such as
invalid input data?
+ How should exception contracts interact with generic code?
+ Should exception contracts be a part of a subprogram's type? Consider
access to subprogram values and their usage.
+ How should exception contracts interact with other static analysis
techniques? For example if a subprogram has a contract that says it
might raise exception E, but if static analysis can prove that a
particular usage will not actually raise E, does the programmer have to
declare a contract on the calling subprogram about E? One objection I've
heard about exception specifications in Java is that they require
programmers to either specify (or handle) exceptions that "clearly" can
never actually arise at that particular program point.
Now that Ada has preconditions the last point is particularly acute. The
precondition on a procedure P might guarantee that a called subprogram
won't raise an exception that it might nevertheless declare in its
exception contract. It would be really unpleasant if the programmer had
to also add an exception contract to P stating that it might raise an
exception that the programmer knows the precondition will prevent!
This is just a sample of some of the issues involved in the subject.
There are those who have answers for all of these issues. That's great.
But again I sincerely hope that if exception contracts are ever
seriously considered for Ada that the matter be given the deep
consideration it deserves.
Peter
next prev parent reply other threads:[~2012-12-24 15:49 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-18 7:45 Press Release - Ada 2012 Language Standard Approved by ISO Dirk Craeynest
2012-12-18 16:57 ` Robert A Duff
2012-12-18 21:12 ` Bill Findlay
2012-12-18 21:36 ` Jeffrey Carter
2012-12-18 21:57 ` Bill Findlay
2012-12-19 8:33 ` Dmitry A. Kazakov
2012-12-19 9:00 ` Georg Bauhaus
2012-12-19 9:19 ` Dmitry A. Kazakov
2012-12-19 9:21 ` Georg Bauhaus
2012-12-19 9:38 ` Dmitry A. Kazakov
2012-12-19 12:23 ` Georg Bauhaus
2012-12-19 14:34 ` Bill Findlay
2012-12-20 1:52 ` Randy Brukardt
2012-12-21 9:01 ` Dmitry A. Kazakov
2012-12-21 10:13 ` Georg Bauhaus
2012-12-21 10:34 ` Georg Bauhaus
2012-12-21 13:38 ` Dmitry A. Kazakov
2012-12-22 1:40 ` Randy Brukardt
2012-12-22 9:02 ` Dmitry A. Kazakov
2012-12-22 22:38 ` Georg Bauhaus
2012-12-23 8:08 ` Dmitry A. Kazakov
2012-12-23 23:38 ` Shark8
2012-12-24 2:44 ` sbelmont700
2012-12-24 5:29 ` Shark8
2012-12-25 21:51 ` Florian Weimer
2012-12-27 1:00 ` sbelmont700
2012-12-27 1:47 ` Randy Brukardt
2012-12-27 14:29 ` sbelmont700
2012-12-27 15:30 ` Dmitry A. Kazakov
2012-12-27 18:48 ` Jeffrey Carter
2012-12-27 21:54 ` Randy Brukardt
2012-12-27 22:09 ` J-P. Rosen
2013-01-11 11:41 ` Yannick Duchêne (Hibou57)
2013-01-11 11:35 ` Yannick Duchêne (Hibou57)
2013-01-11 16:13 ` Jacob Sparre Andersen
2013-01-12 2:06 ` Randy Brukardt
2013-01-11 11:33 ` Yannick Duchêne (Hibou57)
2013-01-11 14:15 ` Dmitry A. Kazakov
2013-01-11 16:19 ` File_Exists (Was: Press Release - Ada 2012 Language Standard Approved by ISO) Jacob Sparre Andersen
2013-01-11 19:36 ` Yannick Duchêne (Hibou57)
2013-01-14 5:09 ` File_Exists Jacob Sparre Andersen
2013-01-12 7:55 ` File_Exists (Was: Press Release - Ada 2012 Language Standard Approved by ISO) Georg Bauhaus
2012-12-27 20:12 ` compilers, was Re: Press Release - Ada 2012 Language Standard Approved by ISO tmoran
2012-12-27 20:54 ` Shark8
2012-12-27 22:00 ` Randy Brukardt
2012-12-27 10:05 ` Dmitry A. Kazakov
2013-01-11 11:28 ` Yannick Duchêne (Hibou57)
2013-01-11 14:21 ` Dmitry A. Kazakov
2013-01-11 14:23 ` Yannick Duchêne (Hibou57)
2012-12-24 6:44 ` Yannick Duchêne (Hibou57)
2012-12-24 9:02 ` Dmitry A. Kazakov
2012-12-24 11:13 ` Yannick Duchêne (Hibou57)
2012-12-24 15:49 ` Peter C. Chapin [this message]
2012-12-24 16:34 ` Exception contracts for Ada? Was: " Dmitry A. Kazakov
2012-12-24 19:45 ` Exception contracts for Ada? Peter C. Chapin
2012-12-25 11:09 ` Dmitry A. Kazakov
2012-12-27 2:38 ` Randy Brukardt
2012-12-27 2:16 ` Exception contracts for Ada? Was: Re: Press Release - Ada 2012 Language Standard Approved by ISO Randy Brukardt
2012-12-27 15:03 ` Peter C. Chapin
2012-12-27 1:17 ` Randy Brukardt
2013-01-11 17:10 ` Marius Amado-Alves
2012-12-20 21:55 ` Anh Vo
2012-12-21 1:04 ` Bill Findlay
2012-12-18 23:24 ` Randy Brukardt
2012-12-19 8:35 ` Georg Bauhaus
2012-12-19 9:03 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox