comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
Subject: Re: Thoughts on the ADaOS user program interface
Date: Sat, 08 Sep 2001 13:42:27 +0200
Date: 2001-09-08T13:42:27+02:00	[thread overview]
Message-ID: <87sndxdi3g.fsf@deneb.enyo.de> (raw)
In-Reply-To: 3B98FA64.4080907@home.com

"Warren W. Gay VE3WWG" <ve3wwg@home.com> writes:

>> Error reporting should be done by throwing exceptions with a descriptive
>> error message attached.  My experience is that more often than not,
>> if a system call fails the program logic doesn't care why it fails.

> I have to disagree here. This may often be the case in some class of
> applications, but servers and other more system-level software _do_
> indeed care, and often must take appropriate action.

You can have the best of both worlds.  I call this "parameterized
exceptions": The exception message contains a machine-readable error
code at the beginning (which can be something converted to a
human-readable string, too), and exception handlers can retrieve this
kind of information easily.  As a side effect, throwing exceptions
becomes more expensive, but I think that this is not a problem.

I'm going to use this approach to get rid of thread-specific state
(and the alternative, a myriad of different exceptions) for my
low-level Ada binding for POSIX-like operating systems.

IMHO, the possibility to pass a value of a discrete type as a
parameter along with exceptions would be nice addition to the language
(passing values of any type creates too much problems).



      parent reply	other threads:[~2001-09-08 11:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-06 18:18 Thoughts on the ADaOS user program interface Kenneth Almquist
2001-09-07  8:24 ` Dmitry Kazakov
2001-09-07 16:48 ` Warren W. Gay VE3WWG
2001-09-07 19:35   ` David Starner
2001-09-08 11:42   ` Florian Weimer [this message]
replies disabled

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