comp.lang.ada
 help / color / mirror / Atom feed
From: David Emery <demery@cox.net>
Subject: Re: ISO/IEC 14519 - Ada POSIX binding
Date: Sat, 21 Jun 2003 17:47:06 -0400
Date: 2003-06-21T17:47:06-04:00	[thread overview]
Message-ID: <un4Ja.7658$ZE.5855@lakeread05> (raw)
In-Reply-To: <87r85nqlwa.fsf@deneb.enyo.de>

Florian Weimer wrote:

> David Emery <demery@cox.net> writes:
> 
> 
>>If you read the rationale (one of the best parts of the document,
>>IMHO), you'll see that the primary consideration for this decision
>>is the fact that the set of errors for any given POSIX system call
>>is NOT fixed.  POSIX defines a minimum set of error conditions,
>>implementations may add additional errors (and most have, particularly
>>as network-based computing has expanded.) Any error handling technique
>>must accomodate extension.
> 
> 
> And the POSIX.5 mechanism gives us this extensibility?  I don't think
> so.
> 
> If a POSIX.5 implementation raises an exception not expected by the
> application, it won't be able to attribute it to the POSIX subsystem
> at all (unless the application jumps through hoops and uses the Ada 95
> feature that yields the full expanded name of the exception).

An implementation of POSIX.5 that raises any exception other than
POSIX.POSIX_Error (or the predefined exceptions), is NON-CONFORMING
(i.e. "wrong").

The error reporting model is for the POSIX call to raise
POSIX.POSIX_Error.  (Unlike in C...) The application program must
handle this exception somehow, or be terminated.  (In the latter
case, the value of the POSIX process's return code is 42, "Unhandled
Exception."  If this number sounds familiar, you're right.  See the
Rationale for an explanation :-).

Anyway, it's up to the application program to do The Right Thing.
Good practice would be
	CALL_POSIX: begin
		posix_system_call (...);
	exception
		when POSIX.POSIX_Error =>
			case POSIX.Error_Code is
				-- don't quote me on the exact
				-- error code values below
				when POSIX.No_Such_File => ...
				when POSIX.Bad_File_Descriptor => ...
				when others => ...
					-- represents an error the
					-- application cannot handle
		when others => ...
	end CALL_POSIX;

So let's consider the extensibility of this approach.
We add a new error code, "No_Such_Machine".  This could get invoked
by Open() when the pathname starts with 2 slashes, e.g.
	open (file => "//www.adahome.com/updates", ...);
	exception
		when POSIX.POSIX_Error =>
			case POSIX.Error_Code is
			....
If we want, we can add
				when POSIX.No_Such_Machine => ...
to the application, when we know about this new error -AND- what we
should do about it.

A poorly coded application can always do
				when others => null;  -- can't handle
But a better-coded application should do
				when others =>
				    action_for_unknown_problem;

But in ALL CASES, there is a single exception that gets raised,
POSIX.POSIX_Error.

				dave	




  reply	other threads:[~2003-06-21 21:47 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-19 21:43 ISO/IEC 14519 - Ada POSIX binding Mark Lorenzen
2003-06-19 21:29 ` tmoran
2003-06-28 23:48   ` Richard Riehle
2003-06-20 11:57 ` Marin David Condic
2003-06-20 14:08   ` Ludovic Brenta
2003-06-20 16:39     ` Warren W. Gay VE3WWG
2003-06-20 18:33       ` tmoran
2003-06-20 19:09         ` Warren W. Gay VE3WWG
2003-06-21 19:14         ` Florian Weimer
2003-06-21 19:42           ` tmoran
2003-06-21 21:04             ` Robert I. Eachus
2003-06-29 15:05             ` Florian Weimer
2003-06-20 19:24       ` Georg Bauhaus
2003-06-20 20:49         ` Warren W. Gay VE3WWG
2003-06-20 20:49       ` Wesley Groleau
2003-06-20 23:05         ` Mark Lorenzen
2003-06-21  1:49         ` David Emery
2003-06-21 19:19           ` Florian Weimer
2003-06-21 21:47             ` David Emery [this message]
2003-06-21 22:22               ` Larry Kilgallen
2003-06-23 16:13               ` Warren W. Gay VE3WWG
2003-06-23 22:41                 ` Berend de Boer
2003-06-24  9:52                   ` Lutz Donnerhacke
2003-06-24 20:43                     ` Berend de Boer
2003-06-25  9:02                       ` Pascal Obry
2003-06-25  9:46                       ` Lutz Donnerhacke
2003-06-25 21:19                         ` Berend de Boer
2003-06-21 13:01       ` Pascal Obry
2003-06-21 12:11     ` Marin David Condic
2003-06-21 12:44       ` Ludovic Brenta
2003-06-21 13:03         ` Larry Kilgallen
2003-06-21 22:28           ` Ludovic Brenta
2003-06-22  3:45             ` Larry Kilgallen
2003-06-22  8:47               ` Mark Lorenzen
2003-06-23 16:36         ` Warren W. Gay VE3WWG
2003-06-24 11:46           ` Marin David Condic
2003-06-21 19:09 ` Florian Weimer
2003-06-21 22:38   ` Mark Lorenzen
2003-06-21 22:51     ` Ludovic Brenta
2003-06-23 16:54       ` Warren W. Gay VE3WWG
2003-06-24 11:49         ` Marin David Condic
2003-06-24 13:31           ` Warren W. Gay VE3WWG
2003-06-23 16:46     ` Warren W. Gay VE3WWG
2003-06-23 22:43       ` Berend de Boer
2003-06-29 15:10     ` Florian Weimer
2003-06-29 20:58       ` David Emery
replies disabled

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