comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Structured exception information
Date: Tue, 23 Jan 2007 15:21:09 +0100
Date: 2007-01-23T15:21:09+01:00	[thread overview]
Message-ID: <whjok6zzdisu.t6spc9vchgp3.dlg@40tude.net> (raw)
In-Reply-To: ufya2dwxf.fsf@stephe-leake.org

On Tue, 23 Jan 2007 02:28:12 -0500, Stephen Leake wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> 
>>>> As a practical example, consider mail non-delivery. A returned mail plus
>>>> traceback is the information to you, the handler from the exception point.
>>> 
>>> To me, bounced emails are _not_ "exceptional" events in mail handling
>>> systems; they are expected, even "normal".
>>
>> We agree on that. 
> 
> Good.
> 
>> But that is not the problem we are discussing. Which simplified is
>> whether an API procedure Send_Mail should add a non-string
>> information to the Delivery_Error exception, or else pack it in a
>> String. I prefer the former.
> 
> Ah. Apparently you don't agree with me, or you missed my point.
> 
> Since bounced emails are not exceptional events, they should not be
> handled by exceptions. Send_Mail should return status information, as
> much as it wants to, for bounced emails; it should _not_ raise an
> exception in this case.

Oops, then you reject use of exceptions here. That would be a different
discussion then.

> If you are talking about the sensor system, then I _have_ seen real
> examples of that, and it is not clumsy; it solves the problem of
> possibly failed sensors quite nicely.

Good, let's drop that E-mail stuff, because sensors seem to be closer to
both of us.

> Basically, the result of any sensor read is a record:
> 
> type Sensor_Result_Type is record
>     Quality : Quality_Type;
>     Value   : Value_Type;
> end record;
> 
> Any algorithm that deals with the sensor must be prepared for Quality
> to be Bad.

I don't think so. From a system-wide perspective, yes, sure, but locally I
have a problem with that. Let's consider:

   function "+" (X, Y : Sensor_Result_Type) return Value_Type;

We have to discard this on the same reasons (if we had accepted them (:-))
and replace it with:

   function "+" (X, Y : Sensor_Result_Type) return Sensor_Result_Type;

Now, before we would rush into developing a home-brewed IEEE arithmetic.
May I ask you, how Quality_Type compose under "+"? I know what 1+2 is, but
what is (1, Try_Again) + (2, Change_Battery)?

(2, First_Change_Then_Try)? (:-))

> Note that the algorithm is not just skipped; it probably uses an
> estimate based on past values.

Yes, these are not exceptional states, they are parts of some composite
value. Nobody would implement that using exceptions. It would be like file
Read raising exception on each read character and returning EOF if there
were no one. (:-)) Let's don't consider measurement errors and concentrate
on hardware faults.

> Only when the sensor is Bad for some
> finite time is it declared Permanently_Bad; then the system will
> switch to the backup sensor, or an algorithm that does not use that
> sensor.

OK, this is a third case. Timeouts are handled in a similar way. Before an
exceptional state is entered one ignores the data/service quality assuming
that everything is alright, because no reasonable estimation could be made
anyway before the timeout expires.

>> Further it is a bad design, because it eludes to face the problem by
>> putting all the responsibility to deal with on the user's shoulders.
> 
> Say what?
> 
> Whether the status information is passed in an 'out' parameter, or as
> part of a structured exception, or packed into an exception string,
> the user still has to deal with it.
> 
> We are only discussing the parameter passing mechanism, not who is
> going to deal with the information.

Full agreement.

But the mechanism of passing is very different. In case of exceptions it is
fully transparent for the layers where the exception is being propagated
unhandled. A big difference.

>> The user of API must check the status later. 
> 
> Why "later"? Since bouncing is expected, that status must be checked
> immediately; that's the point.
> 
> For the sensor, the quality is packaged with the value, they are
> always examined together.

See the example with "+".

>> Note, even if we considered a middleware layer, in which the sensor
>> variable would indeed have a status field and a lot of other fields to make
>> the internals working, even in this design, the argument would still
>> hold.
> 
> I'm lost; which argument?

Actually your Sensor_Result_Type is exactly what I had in mind.

>> Because then, when accessing such variable object, one would again need an
>> exception and an information about the status in it. Otherwise one would
>> have quite nasty race condition issues when accessing such variables - you
>> check the status, get preempted and then read a rubbish value.
> 
> Say what? Once the sensor has been read, all of the information is in
> an object of Result_Type; there is no race condition in reading the
> components of Result_Type.

Consider it a protected object, with Get_Quality and Get_Value functions.
(a middleware is a kind of bunch of such objects)

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2007-01-23 14:21 UTC|newest]

Thread overview: 181+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-15 13:44 Structured exception information Maciej Sobczak
2007-01-15 17:17 ` claude.simon
2007-01-16  9:04   ` Maciej Sobczak
2007-01-16 22:39     ` Randy Brukardt
2007-01-15 17:28 ` Robert A Duff
2007-01-15 18:29   ` Georg Bauhaus
2007-01-15 19:44     ` Dmitry A. Kazakov
2007-01-15 20:06       ` Georg Bauhaus
2007-01-15 21:56         ` Randy Brukardt
2007-01-15 22:32           ` Robert A Duff
2007-01-16 18:36             ` Ray Blaak
2007-01-16 19:18               ` C# versus Ada (was: Structured exception information) Georg Bauhaus
2007-01-16 23:29                 ` C# versus Ada Markus E Leypold
2007-01-18 10:22                   ` Dmitry A. Kazakov
2007-01-17 18:14                 ` C# versus Ada (was: Structured exception information) Ray Blaak
2007-01-16 23:27               ` Structured exception information Markus E Leypold
2007-01-17  7:28               ` Martin Krischik
2007-01-16 22:36             ` Randy Brukardt
2007-01-17 16:12               ` Bob Spooner
2007-01-17 23:42                 ` Randy Brukardt
2007-01-16  9:11           ` Dmitry A. Kazakov
2007-01-16 10:45             ` Maciej Sobczak
2007-01-16 13:26               ` Dmitry A. Kazakov
2007-01-16 14:44                 ` Maciej Sobczak
2007-01-16 15:15                   ` Dmitry A. Kazakov
2007-01-16 17:50             ` Jeffrey Carter
2007-01-16 18:31               ` Dmitry A. Kazakov
2007-01-16 22:52                 ` Randy Brukardt
2007-01-17  8:58                   ` Dmitry A. Kazakov
2007-01-17 18:38                     ` Jeffrey Carter
2007-01-17 23:18                       ` Randy Brukardt
2007-01-17 23:46                         ` Robert A Duff
2007-01-18  6:34                         ` Jeffrey Carter
2007-01-19  7:34                           ` Randy Brukardt
2007-01-19 13:52                             ` Dmitry A. Kazakov
2007-01-19 18:57                               ` Jeffrey Carter
2007-01-19 19:57                                 ` Robert A Duff
2007-01-20 20:59                                   ` Jeffrey Carter
2007-01-18  9:55                       ` Dmitry A. Kazakov
2007-01-18 18:28                         ` Jeffrey Carter
2007-01-17 23:36                     ` Randy Brukardt
2007-01-18 10:16                       ` Dmitry A. Kazakov
2007-01-15 22:19     ` Robert A Duff
2007-01-16 13:12       ` Georg Bauhaus
2007-01-15 22:42 ` Adam Beneschan
2007-01-15 23:22   ` Robert A Duff
2007-01-16  6:03     ` tmoran
2007-01-16 13:30 ` Stephen Leake
2007-01-16 14:33   ` Maciej Sobczak
2007-01-16 14:45     ` Georg Bauhaus
2007-01-16 17:54     ` Jeffrey Carter
2007-01-16 22:55       ` Randy Brukardt
2007-01-17 12:10     ` Stephen Leake
2007-01-17 14:05       ` Maciej Sobczak
2007-01-19  9:47         ` Stephen Leake
2007-01-19 11:03           ` Dmitry A. Kazakov
2007-01-20 15:04             ` Stephen Leake
2007-01-21 10:40               ` Dmitry A. Kazakov
2007-01-23  7:28                 ` Stephen Leake
2007-01-23 14:21                   ` Dmitry A. Kazakov [this message]
2007-01-25  2:39                     ` Stephen Leake
2007-01-19 13:36           ` Maciej Sobczak
2007-01-20 15:33             ` Stephen Leake
2007-01-20 16:33               ` Robert A Duff
2007-01-21 22:42                 ` Stephen Leake
2007-01-21 23:45                   ` Robert A Duff
2007-01-22  9:14                     ` Maciej Sobczak
2007-01-23  7:33                     ` Stephen Leake
2007-01-23 15:07                       ` Robert A Duff
2007-01-23 15:54                         ` Maciej Sobczak
2007-01-23 17:10                           ` Robert A Duff
2007-01-23 23:59                       ` Randy Brukardt
2007-01-22  9:28               ` Maciej Sobczak
2007-01-23  9:46                 ` Stephen Leake
2007-01-23 14:18                   ` Maciej Sobczak
2007-01-25  2:32                     ` Stephen Leake
2007-01-25  8:53                       ` Maciej Sobczak
2007-01-26  9:35                         ` Stephen Leake
2007-01-26 11:16                           ` Markus E Leypold
2007-01-26 13:46                           ` Georg Bauhaus
2007-01-27 18:17                             ` Stephen Leake
2007-01-28 12:38                               ` Simon Wright
2007-01-28 12:39                               ` Simon Wright
2007-01-28 13:18                               ` Stephen Leake
2007-01-28 15:44                                 ` Georg Bauhaus
2007-01-28 21:48                                 ` Ray Blaak
2007-01-28 18:50                               ` Georg Bauhaus
2007-01-30  2:15                                 ` Stephen Leake
2007-01-31 18:58                                   ` Georg Bauhaus
2007-02-01 12:20                                     ` Stephen Leake
2007-02-01 14:17                                       ` Georg Bauhaus
2007-01-25 21:52                       ` Randy Brukardt
2007-01-24  0:10                   ` Randy Brukardt
2007-01-24 14:17                     ` Wasteful internationalization (Was: Structured exception information) Alex R. Mosteo
2007-01-24 14:49                       ` Dmitry A. Kazakov
2007-01-24 23:48                         ` Wasteful internationalization Björn Persson
2007-01-25  9:45                           ` Markus E Leypold
2007-01-24 21:03                       ` Wasteful internationalization (Was: Structured exception information) Randy Brukardt
2007-01-25 11:17                         ` Alex R. Mosteo
2007-01-25 21:37                           ` Wasteful internationalization Björn Persson
2007-01-25 21:57                           ` Wasteful internationalization (Was: Structured exception information) Randy Brukardt
2007-01-26  9:13                             ` Dmitry A. Kazakov
2007-01-26 12:12                               ` Georg Bauhaus
2007-01-27  4:09                               ` Randy Brukardt
2007-01-27 17:15                             ` Wasteful internationalization Stephen Leake
2007-01-27 20:44                               ` Markus E Leypold
2007-01-28  0:09                                 ` Björn Persson
2007-01-28  1:08                                   ` Björn Persson
2007-01-28 15:21                                     ` Markus E Leypold
2007-01-29  1:23                                       ` Larry Kilgallen
2007-01-29 19:02                                         ` Björn Persson
2007-01-29 20:19                                           ` Larry Kilgallen
2007-02-01  6:23                                             ` Simon Wright
2007-02-03  0:48                                             ` Björn Persson
2007-02-03  1:04                                               ` Adam Beneschan
2007-02-03 11:52                                                 ` Larry Kilgallen
2007-02-03  2:36                                               ` Markus E Leypold
2007-02-03  2:37                                                 ` Markus E Leypold
2007-02-03 19:59                                                 ` Björn Persson
2007-02-03 20:16                                                   ` Markus E Leypold
2007-02-05 19:26                                                     ` Björn Persson
2007-02-04  4:51                                                   ` Alexander E. Kopilovich
2007-02-05 19:27                                                     ` Björn Persson
2007-02-06  1:32                                                   ` Randy Brukardt
2007-02-06  1:54                                                     ` Markus E Leypold
2007-02-07  1:55                                                       ` Björn Persson
2007-02-07  2:20                                                         ` Markus E Leypold
2007-02-12  1:33                                                           ` Björn Persson
2007-02-12  8:16                                                             ` Franz Kruse
2007-02-12  9:20                                                             ` Not at all wasteful internationalization Martin Krischik
2007-02-12 11:08                                                               ` Georg Bauhaus
2007-02-12 13:02                                                                 ` Martin Krischik
2007-02-07 20:39                                                         ` Wasteful internationalization Randy Brukardt
2007-02-08 13:33                                                           ` Stephen Leake
2007-02-12  2:42                                                           ` Björn Persson
2007-02-06 11:01                                                     ` Peter Hermann
2007-02-06 19:02                                                     ` OT: Flash (was: Re: Wasteful internationalization) Jeffrey R. Carter
2007-02-06 19:40                                                       ` OT: Flash Markus E Leypold
2007-02-03 11:51                                               ` Wasteful internationalization Larry Kilgallen
2007-01-29 18:54                                       ` Björn Persson
2007-01-29 19:03                                         ` Markus E Leypold
2007-01-30 17:46                                           ` Georg Bauhaus
2007-01-30 19:37                                             ` Markus E Leypold
2007-01-30 20:43                                               ` Georg Bauhaus
2007-01-30 20:50                                                 ` Georg Bauhaus
2007-01-30 21:54                                                 ` Markus E Leypold
2007-01-31 11:26                                               ` Alex R. Mosteo
2007-01-31 15:17                                                 ` Markus E Leypold
2007-02-03  0:49                                                 ` Björn Persson
2007-02-03 16:05                                                   ` Alex R. Mosteo
2007-02-03  0:48                                               ` Björn Persson
2007-02-01 12:08                                             ` Stephen Leake
2007-02-03  0:49                                               ` Björn Persson
2007-02-03  9:46                                                 ` Dmitry A. Kazakov
2007-02-03 18:48                                                 ` Stephen Leake
2007-02-03 20:27                                                   ` Björn Persson
2007-01-30  2:20                                       ` Stephen Leake
2007-01-30 10:01                         ` Wasteful internationalization (Was: Structured exception information) Harald Korneliussen
2007-01-19 15:45           ` Structured exception information Robert A Duff
2007-01-20 16:08             ` Stephen Leake
2007-01-20 21:59               ` Robert A Duff
2007-01-19 18:14           ` Ray Blaak
2007-01-19 20:07           ` Robert A Duff
2007-01-20 16:16             ` Stephen Leake
2007-01-20 21:20               ` Ray Blaak
2007-01-21 22:34                 ` Stephen Leake
2007-01-20 22:07               ` Robert A Duff
2007-01-21 10:45                 ` Dmitry A. Kazakov
2007-01-21 23:51                   ` Robert A Duff
2007-01-22 14:39                     ` Dmitry A. Kazakov
2007-01-22 19:02                       ` Robert A Duff
2007-01-23 14:23                         ` Dmitry A. Kazakov
2007-01-29  1:30   ` Brian May
2007-01-16 13:30 ` Structured exception information (task, ANEX E) Martin Krischik
2007-01-16 23:07   ` Randy Brukardt
2007-01-19 16:01   ` Robert A Duff
2007-01-22  7:17     ` Martin Krischik
2007-01-22 19:40       ` Robert A Duff
2007-01-16 15:48 ` Structured exception information Alex R. Mosteo
2007-01-16 18:07   ` Jeffrey Carter
2007-01-17  6:38     ` Duncan Sands
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox