* ADA Exception Handling @ 1998-10-28 0:00 Stefan Papp 1998-10-29 0:00 ` Jerry van Dijk 1998-10-29 0:00 ` Corey Ashford 0 siblings, 2 replies; 6+ messages in thread From: Stefan Papp @ 1998-10-28 0:00 UTC (permalink / raw) Hello, I am currently working on a project on Ada reengineering. My duty is to find out, whether it is possible to presentate exception in Ada graphically. I would be very happy, if somebody could give me some hints on ADA exceptions. As I am not an ADA programmer I have no real experience in ADA exceptions. Is it possible to compare the ADA exception handling to the e.h. from c++ or JAVA? Could anyone tell, if there is something special I need to know about ADA excpetions? Thank you Stefan Papp ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ADA Exception Handling 1998-10-28 0:00 ADA Exception Handling Stefan Papp @ 1998-10-29 0:00 ` Jerry van Dijk 1998-10-29 0:00 ` Corey Ashford 1 sibling, 0 replies; 6+ messages in thread From: Jerry van Dijk @ 1998-10-29 0:00 UTC (permalink / raw) Stefan Papp (Stefan.papp@fhs-hagenberg.ac.at) wrote: : I am currently working on a project on Ada reengineering. My duty is to find : out, whether it is possible to presentate exception in Ada graphically. I would : be very happy, if somebody could give me some hints on ADA exceptions. What do you mean by presenting an exception graphically ? : As I am not an ADA programmer I have no real experience in ADA exceptions. Is : it possible to compare the ADA exception handling to the e.h. from c++ or JAVA? In c++ and Java, exceptions are objects and are caught by type. in contrast Ada exceptions are more like interrupts or signals causing an alternate control flow. Any starters book on Ada will have a better explanation. Jerry. -- -- Jerry van Dijk | email: jdijk@acm.org -- Leiden, Holland | member Team-Ada -- Ada & Win32: http://stad.dsl.nl/~jvandyk ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ADA Exception Handling 1998-10-28 0:00 ADA Exception Handling Stefan Papp 1998-10-29 0:00 ` Jerry van Dijk @ 1998-10-29 0:00 ` Corey Ashford 1998-10-29 0:00 ` Robert A Duff 1998-10-29 0:00 ` Tucker Taft 1 sibling, 2 replies; 6+ messages in thread From: Corey Ashford @ 1998-10-29 0:00 UTC (permalink / raw) Stefan Papp wrote in message <36370fab.0@alijku02.edvz.uni-linz.ac.at>... >Hello, > >I am currently working on a project on Ada reengineering. My duty is to find >out, whether it is possible to presentate exception in Ada graphically. I would >be very happy, if somebody could give me some hints on ADA exceptions. What sort of graphical representation do you have in mind? I can see something like illustrating the call graph of a particular application with exception raising points and their handlers. Did you have something else in mind? > > >As I am not an ADA programmer I have no real experience in ADA exceptions. Is >it possible to compare the ADA exception handling to the e.h. from c++ or JAVA? > Yes. The main difference is that in C++ or Java, the programmer throws and catches objects of any type, whereas in Ada, h programmer throws only something of the predefined type "exception", and the handlers that catch the exception must catch it by its name rather than by its type. Dynamically, however, the concept is similar. The details are a bit different. For example, in C++, an exception can be reraised from outside the exception handler (a.k.a catch block) - for example in a function which is called by the handler. This isn't possible in Ada. On the other hand, C++ doesn't have built-in tasking and so doesn't have to deal with the complications of exceptions being raised during a rendezvous with another task. Hope this gets you started. - Corey >Could anyone tell, if there is something special I need to know about ADA >excpetions? > >Thank you > >Stefan Papp > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ADA Exception Handling 1998-10-29 0:00 ` Corey Ashford @ 1998-10-29 0:00 ` Robert A Duff 1998-10-29 0:00 ` Tucker Taft 1 sibling, 0 replies; 6+ messages in thread From: Robert A Duff @ 1998-10-29 0:00 UTC (permalink / raw) "Corey Ashford" <corey@remove.these.four.words.rational.com> writes: > For example, in C++, an exception can be reraised from outside the exception > handler (a.k.a catch block) - for example in a function which is > called by the handler. This > isn't possible in Ada. It is possible in Ada, using exception occurrences and the Ada.Exceptions package. I agree that for the most part, Ada and C++ exceptions are more-or-less the same. I'd say the biggest difference between Ada and C++ exceptions is that C++ allows you to add information to an exception occurrence in a type-safe way; that is, you declare that information at the point of the exception *type*, and the raising and handling have to agree. You can add information in Ada, too, but it's not type-safe -- you must encode the information as a String. Sigh. - Bob -- Change robert to bob to get my real email address. Sorry. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ADA Exception Handling 1998-10-29 0:00 ` Corey Ashford 1998-10-29 0:00 ` Robert A Duff @ 1998-10-29 0:00 ` Tucker Taft 1998-10-29 0:00 ` Corey Ashford 1 sibling, 1 reply; 6+ messages in thread From: Tucker Taft @ 1998-10-29 0:00 UTC (permalink / raw) Corey Ashford (corey@remove.these.four.words.rational.com) wrote: : Yes. The main difference is that in C++ or Java, the programmer throws : and catches objects of any type, whereas in Ada, h programmer throws only : something of the predefined type "exception", and the handlers that catch : the exception must catch it by its name rather than by its type. Another way of looking at it is that an exception declaration in Ada is effectively declaring a new exception "type," and you still handle exceptions by specifying the type of interest (or "others"). There is a related concept called an exception "occurrence" which is essentially an instance of one of these exception "types." An exception occurrence is created implicitly as part of a "raise" statement, and can be given a name in a handler using the syntax: when E : others => -- Inside here, "E" denotes and exception occurrence. Using the operations in Ada.Exceptions, it is possible to add information into the occurrence created by a "raise" by calling the Raise_Exception operation explicitly (the information needs to be encoded as a string). : Dynamically, however, the concept is similar. The details are a bit different. : For example, in C++, an exception can be reraised from outside the exception : handler (a.k.a catch block) - for example in a function which is called by the handler. This : isn't possible in Ada. Actually, it is possible in Ada 95. You can use the above mentioned syntax to give a name to a handled exception, and then save the exception occurrence in a global using one of the operations of Ada.Exceptions, and then later re-raise the globally-saved occurrence (using Ada.Exceptions.Reraise_Occurrence). Chances are, though, this is much more information than you need to use exceptions in most programs... : ... On the other hand, C++ doesn't have built-in tasking : and so doesn't have to deal with the complications of exceptions being raised : during a rendezvous with another task. : Hope this gets you started. : - Corey : >Could anyone tell, if there is something special I need to know about ADA : >excpetions? : > : >Thank you : > : >Stefan Papp : > -- -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Burlington, MA USA An AverStar Company ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ADA Exception Handling 1998-10-29 0:00 ` Tucker Taft @ 1998-10-29 0:00 ` Corey Ashford 0 siblings, 0 replies; 6+ messages in thread From: Corey Ashford @ 1998-10-29 0:00 UTC (permalink / raw) Thanks for the comments. I thought about adding the info about the newer Ada95 exception features, but I figured it was a bit much for the level of information he originally requested. I also thought about describing Ada exceptions as types too, but the syntax doesn't really make that explanation terribly helpful. If Ada95 had done something like this: subtype Foo is Ada.Exception; ... raise Foo; the "exceptions as types" would be easier to understand, perhaps. - Corey ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1998-10-29 0:00 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1998-10-28 0:00 ADA Exception Handling Stefan Papp 1998-10-29 0:00 ` Jerry van Dijk 1998-10-29 0:00 ` Corey Ashford 1998-10-29 0:00 ` Robert A Duff 1998-10-29 0:00 ` Tucker Taft 1998-10-29 0:00 ` Corey Ashford
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox