comp.lang.ada
 help / color / mirror / Atom feed
From: Ray Blaak <rAYblaaK@STRIPCAPStelus.net>
Subject: Re: contracted exceptions
Date: Thu, 07 Jun 2007 21:11:32 GMT
Date: 2007-06-07T21:11:32+00:00	[thread overview]
Message-ID: <uwsyf5v27.fsf@STRIPCAPStelus.net> (raw)
In-Reply-To: wccwsyfa5vf.fsf@shell01.TheWorld.com

Robert A Duff <bobduff@shell01.TheWorld.com> writes:
> Ray Blaak <rAYblaaK@STRIPCAPStelus.net> writes:
> 
> > "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> >> I would like to see contracted exceptions...
> >
> > The Java experience shows that compiler checked exception
> > specifications don't work.
> 
> I don't quite agree.  I'd say the Java experience shows that the exact
> rules of Java don't work very well.  But that does not imply that the
> whole idea can't work well.

I think the problem is that one cannot reliably predict in advance which
exceptions can propagate. Furthermore this set can change over time as a
system is maintained.

> you want some way to say "Iterate can raise anything that Action can
> raise".  The actual parameter passed to Action, I mean.

My point is that in general it doesn't matter. What happens when something
unexpected is raised anyway? You still have to have a strategy for that.

> Well, the compiler isn't doing the forcing, the programmer who defined
> the exception is.  And you're not forced to handle it; you also have
> the choice of declaring it to be propagated.

The heavy use of 3rd party libraries in Java programs at least dictates it to
the programmer. Sure, the programmer can define better behaviours in their own
software.

Also, declaring exceptions to be propagated cause internal design artifacts to
be propagated to the public specification of the design.

A compromise approach I have seen and used myself is to let all possible
exceptions propagate freely in the internals of a subsystem, and then at the
public edges handle and wrap into the official publically allowable exceptions.

Some more modern Java libraries make use of unchecked exceptions. E.g. the
org.w3c.dom API has its root DOMException type derived from the unchecked
RuntimeException.

> > If one observes what actually is needed for exception processing it tends to
> > be:
> >
> > a) abort control flow - the current op cannot proceed.
> > b) report the error to the user in a central way (in a popup, via a log,
> >    whatever), and either exit or wait for the next new input/action.
> 
> True of some programs.  But many embedded systems have no use for
> popping up or logging.

So what do embedded systems tend to do? They cannot simply halt after all.

My guess is that they handle known (i.e. expected) errors has best they can,
possibly with recovery, but unknown errors simply cause some sort of reset to
a known state. This is still a central strategy, no?

-- 
Cheers,                                        The Rhythm is around me,
                                               The Rhythm has control.
Ray Blaak                                      The Rhythm is inside me,
rAYblaaK@STRIPCAPStelus.net                    The Rhythm has my soul.



  reply	other threads:[~2007-06-07 21:11 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 [this message]
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
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