comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: contracted exceptions
Date: Fri, 08 Jun 2007 08:02:09 -0400
Date: 2007-06-08T08:02:09-04:00	[thread overview]
Message-ID: <wcc1wgm8xj2.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: f4ae75$jtp$1@jacob-sparre.dk

"Randy Brukardt" <randy@rrsoftware.com> writes:

> "Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message
> news:wccwsyfa5vf.fsf@shell01.TheWorld.com...

>> I think Java is on the right track here, and with a few tweaks to the
>> rules would work quite well.
>
> I'm not as convinced. We discussed this subject in the ARG and no one had
> any ideas that were real improvements on the Java situation. (It's too bad
> that you can't come to meetings more often, because you often have a unique
> perspective on things.) Thus the idea was dropped.

With my "implementer of Ada 2005" hat on, I'd say that's probably a good
thing.  ;-)

> It's fairly clear that the default for Ada would have to be to let
> exceptions propagate (for compatibility with existing code, if for no other
> reason). That might actually be the rule change that fixes the Java
> problems, but it also would make any contracts not particularly relevant.

I've been thinking about the issue purely in the abstract
(from-scratch language design).  If you add the "compatibility"
requirement, that probably makes it much harder, or even impossible.
And of course in the context of Ada revisions, compatibility IS a
requirement.

> It is certainly true that in some cases (such as a public library like Claw)
> you really do want to document all of the exceptions propagated (*and
> why!*),

Right, the "why" leads to preconditions and whatnot, as you note below.

>... and some compiler enforcement might be nice. But even there, it
> would seem that such contracts would get in the way of debugging (if a
> violated exception contract caused Program_Error to be raised, the original,
> unexpected exception and its information would be lost, and that would make
> debugging harder. I'd rather know about a Constraint_Error due to a null
> access value being dereferenced than an exception contract being
> violated...).

That's true with or without contracts.  Whenever an exception gets
turned into a different one, for whatever reason, you want debugging
facilities (interactive debugger, logging, etc) to be able to get
their hands on the original.

> Anyway, it would seem that real Preconditions and Invariants would be more
> useful...

Yes.  I'd say preconditions (etc) subsume the Java "what can this raise"
idea.  So my "few tweaks" comment above is rather an understatement.

>... (the rest of the original thread this was split from seems mainly to
> be about a rather weak from of preconditions). We (the ARG) worked a lot
> harder on those, but could never get the inheritance rules quite right. (And
> thus it is dropped from the Amendment for a lack of maturity.)

I did participate in those design discussions.  AdaCore has even
considered implementing that stuff as impl-def pragmas, but I don't
think it will happen any time soon.

- Bob



  parent reply	other threads:[~2007-06-08 12:02 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-06 21:33 Reconsidering assignment Maciej Sobczak
2007-06-06 22:52 ` Ray Blaak
2007-06-07  7:15   ` Maciej Sobczak
2007-06-07 16:34     ` Ray Blaak
2007-06-07  7:10 ` Stefan Lucks
2007-06-07  7:32   ` Maciej Sobczak
2007-06-07 11:11     ` Stefan Lucks
2007-06-07 16:28   ` Ray Blaak
2007-06-07  9:27 ` Dmitry A. Kazakov
2007-06-07 16:54   ` contracted exceptions (was Re: Reconsidering assignment) Ray Blaak
2007-06-07 20:04     ` contracted exceptions Robert A Duff
2007-06-07 21:11       ` Ray Blaak
2007-06-07 23:44         ` Robert A Duff
2007-06-08  2:19       ` Randy Brukardt
2007-06-08  7:39         ` Dmitry A. Kazakov
2007-06-08  8:53           ` Ray Blaak
2007-06-08 12:08             ` Dmitry A. Kazakov
2007-06-08 17:31               ` Ray Blaak
2007-06-08 18:00                 ` Dmitry A. Kazakov
2007-06-08 18:20                   ` Georg Bauhaus
2007-06-08 18:56                     ` Dmitry A. Kazakov
2007-06-08 19:15                   ` Simon Wright
2007-06-09  0:14                     ` Randy Brukardt
2007-06-09  2:44                       ` Larry Kilgallen
2007-06-09  8:21                     ` Dmitry A. Kazakov
2007-06-09 12:32                       ` Simon Wright
2007-06-09 18:38                         ` Dmitry A. Kazakov
2007-06-09 21:04                           ` Simon Wright
2007-06-10  9:21                             ` Dmitry A. Kazakov
2007-06-10 11:49                               ` Simon Wright
2007-06-10 15:20                                 ` Dmitry A. Kazakov
2007-06-11  4:13                                   ` Ray Blaak
2007-06-11  7:58                                     ` Dmitry A. Kazakov
2007-06-11 17:06                                       ` Ray Blaak
2007-06-11 19:57                                         ` Dmitry A. Kazakov
2007-06-10 18:14                                 ` Georg Bauhaus
2007-06-10 18:12                               ` Georg Bauhaus
2007-06-11  7:55                                 ` Dmitry A. Kazakov
2007-06-11 14:15                         ` Bob Spooner
2007-06-11 15:14                           ` Georg Bauhaus
2007-06-11 15:20                             ` (see below)
2007-06-11 16:39                               ` Georg Bauhaus
2007-06-11 19:50                           ` Simon Wright
2007-06-08 11:26         ` Martin Krischik
2007-06-08 12:02         ` Robert A Duff [this message]
2007-06-08 11:22     ` contracted exceptions (was Re: Reconsidering assignment) Martin Krischik
2007-06-08 17:44       ` Ray Blaak
2007-06-08 12:10     ` contracted exceptions Robert A Duff
2007-06-08 15:56       ` Stefan Lucks
2007-06-08 20:27         ` Pascal Obry
2007-06-09  0:19           ` Randy Brukardt
2007-06-09 18:04             ` Robert A Duff
2007-06-09 18:37               ` Dmitry A. Kazakov
2007-06-09 20:43                 ` Robert A Duff
2007-06-10  9:21                   ` Dmitry A. Kazakov
2007-06-11 19:18                   ` Randy Brukardt
2007-06-12  6:55                     ` Jean-Pierre Rosen
2007-06-08 17:40       ` Ray Blaak
2007-06-09 18:14         ` Robert A Duff
2007-06-08 19:18       ` Simon Wright
2007-06-09 22:37   ` Reconsidering assignment Maciej Sobczak
2007-06-10  9:21     ` Dmitry A. Kazakov
2007-06-11  9:04       ` Maciej Sobczak
2007-06-11 13:09         ` Dmitry A. Kazakov
2007-06-11 18:57     ` Randy Brukardt
2007-06-11 21:12       ` Maciej Sobczak
2007-06-12  8:31         ` Dmitry A. Kazakov
2007-06-12  9:31           ` Georg Bauhaus
2007-06-12 10: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