From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,319ef0454c7765d5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-03-25 08:55:22 PST Path: nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!xlink.net!howland.reston.ans.net!gatech!news-feed-1.peachnet.edu!paperboy.wellfleet.com!noc.near.net!eisner!kilgallen From: kilgallen@eisner.decus.org (Larry Kilgallen, LJK Software) Newsgroups: comp.lang.ada Subject: Re: Why no exception hierarchy ? Message-ID: <1995Mar25.110303.9481@eisner> Date: 25 Mar 95 11:03:03 -0500 References: <3ksv4s$f9e@news.uni-c.dk> Organization: DECUServe Date: 1995-03-25T11:03:03-05:00 List-Id: In article , ka@socrates.hr.att.com (Kenneth Almquist) writes: > An example of something that the Ada 83 exception mechanism did not handle > well is binding UNIX system calls to Ada. POSIX.5 maps all system call > errors into a single exception named POSIX_Error, and provides a per-task > error code variable. This is dangerous. Dangerous? Sure. Smells of "errno" !!! > As far as I can tell, Ada 95 provides two ways to resolve this problem, > neither of which I entirely like. One is to encode the error code in the > exception message. Then we could have: > > function get_error_code(x: exception_occurence) return error_code; > > which would translate the exception_message into an error code. This > seems to be an abuse of the intended purpose of the exception_message, > which is to provide human-readable information on the exception. In > The other approach is to map each error code to a separate exception > and use query functions on exception identities to implement classes. > In this case, one would write: > > exception > when occurence : others => > if is_system_call_error(exception_identity(occurence)) then > Have I missed overlooked any possibilities? On VMS, DEC Ada (83) provides the pragma IMPORT_EXCEPTION, allowing you to assign an arbitrary Ada name to your choice of an OS-generated (or layered-product-generated) OS-style exception. Perhaps DEC Ada does the same thing on Unix -- I don't know. I do not know enough about Ada 95 to understand why this would not work, but I would be interested in comments from those who do know about Ada 95. Larry Kilgallen