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-Thread: 103376,699cc914522aa7c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news.glorb.com!newscon02.news.prodigy.net!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Structured exception information (task, ANEX E) Date: Fri, 19 Jan 2007 11:01:01 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <45acd36e$1@news.post.ch> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1169222464 16965 192.74.137.71 (19 Jan 2007 16:01:04 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 19 Jan 2007 16:01:04 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:hmxVoNZLHy0ExnJe2O3/DjR4QkE= Xref: g2news2.google.com comp.lang.ada:8332 Date: 2007-01-19T11:01:01-05:00 List-Id: Martin Krischik writes: > Maciej Sobczak schrieb: > >> Yes, I'm asking for "throwing objects", in the C++ parlance. >> How to do this in Ada? >> If I cannot - how to solve this design problem? > > I believe this was skipped in Ada because of ANEX E and task types. I don't see any problems there. >...You > must understand that Ada exceptions quite often propagated across thread > borders and sometimes - if ANEX E is implemented - over a network > connections to another computer. > > I do not say this is impossible but it could be quite expensive > performance wise. Efficiency is irrelevant to language design. You should never leave a feature out merely because it's slow. What matters is distributed overhead, and I see none here. Yes, if an exception propagates across a network, you have to ship all the data across the network. The programmer controls how much data that is, so it's not a problem. Besides, shipping a String is no more efficient than shipping properly typed data. Many other languages have solved this problem (even in the presence of threads and distributed systems). The obvious solution is that what Ada calls "exception" should be a type (derived from Root_Exception), and what Ada calls "exception occurrence" should be an object of that type. This language design is much simpler than Ada's, because we don't need a bunch of separate concepts, with their own special rules -- just reuse the concepts of type and object. The 200-character limit was a mistake, by the way. It was based on fictitious implementation difficulties. Ada already has functions that return results whose size is not known at the call site (e.g. "return String"). The same memory-management techniques would apply to arbitrary-sized exception occurrences. - Bob