comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Help Me Please :)
Date: 2000/03/28
Date: 2000-03-28T00:00:00+00:00	[thread overview]
Message-ID: <8bp2b8$e7u$1@nnrp1.deja.com> (raw)
In-Reply-To: wccya74m18e.fsf@world.std.com

In article <wccya74m18e.fsf@world.std.com>,
  Robert A Duff <bobduff@world.std.com> wrote:
> There's no hierarchy of exceptions.

I dislike complexification of exception handling. Many Ada
programmers greatly overuse exceptions, and in particular
define far too many separate exceptions. When it comes to
exception handling, the rule should be keep it very simple.

> (On the other hand, Ada *pretends* that it's OK to raise and
> handle Constraint_Error, but if you read RM-11.6, you'll find
> that's not quite true -- and I doubt if any Ada programmer
> other than Tucker Taft actually *understands* 11.6.  So in
> practise, 11.6 says, "Do not handle predefined exceptions.")

Now now, that's completely disconnected from the real world :-)
"In practice", 11.6 says nothing of the sort at all.

It is often useful to be able to handle constraint error.
For example here is the implementation of one of the plus
operators in Calendar in GNAT:

   function "+" (Left : Time; Right : Duration) return Time is
      pragma Unsuppress (Overflow_Check);
   begin
      return (Left + Time (Right));
   exception
      when Constraint_Error =>
         raise Time_Error;
   end "+";

If you don't understand 11.6, at least don't make claims about
it that are excessive :-) Sure, the formulation of 11.6 is
complex, but you have to approach this with a pragmatist's hat
on, not a theoretician's viewpoint.

In practice many many Ada 95 programs have CE handlers and are
in practice perfectly portable. Even if in some cases a
theoretician could prove that it was possible to have an
implementation of Ada 95 that conformed to the RM under
which the handler is "wrong", that is irrelevant if no such
implementations exist or are likely to exist. In other cases,
even the theoretician's will not find any fault with the CE
handler :-)

Yes, Bob, I know you like to have the hope that the Ada RM is
a formal definition which precisely defines what you can and
cannot do. It is nowhere near that for many reasons, and a
pragmatic viewpoint always has to be in effect.



Sent via Deja.com http://www.deja.com/
Before you buy.




  parent reply	other threads:[~2000-03-28  0:00 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-29  0:00 Help Me Please :) Will Mann
2000-03-01  0:00 ` Robert Dewar
2000-03-03  0:00   ` Florian Weimer
2000-03-03  0:00     ` tmoran
2000-03-04  0:00       ` Richard D Riehle
2000-03-05  0:00         ` Steve Arnold
2000-03-17  0:00         ` Robert A Duff
2000-03-18  0:00           ` Richard D Riehle
2000-03-18  0:00           ` James S. Rogers
2000-03-19  0:00             ` Robert A Duff
2000-03-20  0:00               ` Brian Rogoff
2000-03-20  0:00                 ` Tucker Taft
2000-03-20  0:00           ` Florian Weimer
2000-03-22  0:00           ` Mats Weber
2000-03-27  0:00             ` Robert A Duff
2000-03-27  0:00               ` Hyman Rosen
2000-03-28  0:00               ` reason67
2000-03-28  0:00                 ` Robert Dewar
2000-03-29  0:00                   ` reason67
2000-03-29  0:00                   ` Simon Wright
2000-04-06  0:00                   ` Simon Pilgrim
2000-04-07  0:00                     ` Robert Dewar
2000-04-10  0:00                       ` r_c_chapman
2000-03-28  0:00               ` Robert Dewar [this message]
2000-03-30  0:00                 ` Mats Weber
2000-04-06  0:00                   ` Exceptions (was: " Wes Groleau
2000-04-07  0:00                     ` Mats Weber
2000-03-29  0:00               ` Richard D Riehle
2000-03-29  0:00                 ` Robert Dewar
2000-03-31  0:00                   ` Richard D Riehle
2000-03-31  0:00                     ` Jean-Pierre Rosen
2000-03-31  0:00                       ` Pascal Obry
2000-03-30  0:00                 ` Mats Weber
2000-03-31  0:00                   ` Richard D Riehle
2000-04-06  0:00                 ` Wes Groleau
2000-03-30  0:00               ` Mats Weber
2000-03-30  0:00               ` Tucker Taft
     [not found]     ` <2000Mar3.183321.69279@ludens>
2000-03-03  0:00       ` Larry Kilgallen
2000-03-04  0:00       ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
2000-02-29  0:00 Will Mann
2000-02-29  0:00 ` Stanley R. Allen
2000-02-29  0:00   ` Al Johnston
2000-03-01  0:00     ` Robert Dewar
2000-03-01  0:00     ` tmoran
2000-03-01  0:00       ` Al Johnston
2000-03-02  0:00       ` Aidan Skinner
2000-03-01  0:00     ` Robert Dewar
2000-03-01  0:00       ` Al Johnston
2000-03-01  0:00     ` Stanley R. Allen
2000-03-01  0:00 ` tmoran
2000-03-01  0:00 ` James Bean
     [not found] <df481109.0106140310.5d923746@posting.google.com>
     [not found] ` <9gb1uu$87u7o$1@ID-52877.news.dfncis.de>
2001-06-19  2:59   ` help me please! Ken Garlington
2001-06-16 10:20     ` C.D.Damron
2001-06-20  6:06     ` John Keeney
replies disabled

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