comp.lang.ada
 help / color / mirror / Atom feed
From: sk <noname@myob.com>
To: comp.lang.ada@ada.eu.org
Subject: Re: Ada 0x, exception idea ?
Date: Mon, 28 Jul 2003 06:24:41 -0500
Date: 2003-07-28T06:24:41-05:00	[thread overview]
Message-ID: <mailman.10.1059391475.320.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: 3F229597.3090909@myob.com

strohm@airmail.net:
  > Would you please clarify?

Yes, the post you were replying to suggested parsing
the string message attached to an exception to evaluate
an error code provided in the message by Raise_Exception,
hence my response of "Yuck"

wesgroleau@myrealbox.com:
  > Why is the above (which works now) more "bulky" ...

After a brief play with it, I agree, the "case-and-raise"
syntax is a lot more elegent than a big "if-then-elsif".

However,
  > case Error_Type'Value(Ada.Exceptions.Exception_Message(E)) is
  >   when 1 =>
  >     Handle_Error_One;
quickly wanders into the realms of the unreadable.

strohm@airmail.net:
  > Observe that you get PRECISELY the same result with
  >  if Result = Bummer then raise Its_A_Bummer; end if;
  >  if Result = Darn   then raise Darn_It;      end if;
  >  if Result = Blast  then raise Blast_It;     end if;

Again, the issue isn't results, it is readability.

hyrosen@mail.com:
  > Perhaps the OP has fallen under the allure of Perl,
Haha, whenever I run across Perl, I run away and can
happily claim no base Perl motives :-)

--
This thread has diverged ...
1) concerning the simple addition to a "raise" statement.
2) the usage of Ada.Exceptions and carrying around of
error codes.

As far as the second issue goes, I have no real concerns
one way or another.

However, for the first issue, I stand by the idea that
a conditional raise statement enhances readability.

--
PS. If you stop and think about it, the whole exception
raising and handling is "syntactic sugar" anyway. To
raise an exception, code has to be in place to detect
that a requested operation cannot complete without
breaking the boundaries/parameters/context of the
requestor.

The "raise" and subsequent handlers are a shorthand,
provided by the language, to ensure that all the
necessary checks are implemented rather than relying
on the coders diligence to implement them.

-- 
-------------------------------------------------
-- Merge vertically for real address
--
--     s n p @ t . o
--      k i e k c c m
-------------------------------------------------





  parent reply	other threads:[~2003-07-28 11:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3F229597.3090909@myob.com>
2003-07-27 11:42 ` Ada 0x, exception idea ? sk
2003-07-27 15:33   ` Nick Roberts
2003-07-27 17:13     ` Samuel Tardieu
2003-07-28 12:41       ` Nick Roberts
2003-07-28  0:23   ` Wesley Groleau
2003-07-28  2:46     ` John R. Strohm
2003-07-28  3:23       ` Hyman Rosen
2003-07-28  3:24       ` Hyman Rosen
2003-07-27 15:51 ` sk
2003-07-27 17:22   ` Nick Roberts
2003-07-27 19:30     ` sk
2003-07-27 23:04       ` John R. Strohm
2003-07-28  0:07     ` sk
2003-07-28  0:27       ` Wesley Groleau
2003-07-28  2:50       ` John R. Strohm
2003-07-28  0:21 ` sk
2003-07-28  8:38   ` Preben Randhol
2003-07-28 11:24 ` sk [this message]
2003-07-26 14:52 sk
2003-07-26 15:53 ` John R. Strohm
2003-07-26 17:08   ` sk
2003-07-26 17:08   ` sk
2003-07-27  2:46     ` Wesley Groleau
2003-07-27 16:35     ` Hyman Rosen
2003-07-27  9:10 ` Preben Randhol
replies disabled

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