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,9d303864ae4c70ad X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-10 08:36:00 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: wojtek@power.com.pl (Wojtek Narczynski) Newsgroups: comp.lang.ada Subject: Re: Reprise: 'in out' parameters for functions Date: 10 Apr 2004 08:35:59 -0700 Organization: http://groups.google.com Message-ID: <5ad0dd8a.0404100735.7b2a8317@posting.google.com> References: <5ad0dd8a.0404090512.15af2908@posting.google.com> <5ad0dd8a.0404091828.6e79bb4e@posting.google.com> NNTP-Posting-Host: 83.27.22.36 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1081611360 13414 127.0.0.1 (10 Apr 2004 15:36:00 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 10 Apr 2004 15:36:00 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:6951 Date: 2004-04-10T08:35:59-07:00 List-Id: Dimitry, > This has nothing to do with abstraction inversion. Would you please take care to explain to me, what abstraction inversion is, according to you? For me abstraction inversion is when you need to build low level primitives from high level primitives (built on low level primitives), because the high level primitives are not expressive enough. > The problem here is that Ada does not have multiple > protected actions. Google has not heard of "multiple protected actions", neither have I. But I think know what you mean, for my own needs I was calling this "compound protected". It seems to require proper tail recursion to work. At least we seem to agree that Ada concurrency features also have warts. --- > This is wrong: > > http://home.t-online.de/home/Christ-Usch.Grein/Ada/Dimension.html > > The type system is capable to express dimensioned units. By "express" I don't mean bent over in an such a way that your compiler checked your units for you, nor have your compiler mostly check your units for you, nor write yet another compiler to work on top of your compiler. I mean have your compiler statically check your units for you. I am afraid that this link show exactly that I am, unfortunately, right. The two compile time solutions are: 1. "Checks in assignments concerning physical dimensions are not performed.", 2. From what I've been able to understand Macks has a language, which compiles to Ada. --- > > From the language? For example parameters for exceptions. > > How they could have parameters? There are only two ways for dealing > with exceptions. Either 1) all of them are of one [specific] type > (maybe an implicit one) or 2) they are of different types (maybe > rooted in the same root type [class-wide approach]). You seem to be very well educated in Matematics. Thus you know that inexistence proofs are among the hardest. Please don't provoke me to ask you to proove that there are only two ways of dealing with exceptions. And once you assume false, you can prove anything. > Ada has 1), which excludes parameters. If you think that 2) would be > better for Ada then solve the following: You assumed that the root type for Exception would be tagged record. Indeed with this assumption it may be hard to maintain the conceptual integrity of the language. But I think this level of parametrization is an overkill. I'd rather use something like "discriminated records with discriminants only". Here is a version to start with (which actually compiles and "works"): generic package Crazy is Bang: exception; function T return Boolean; end Crazy; package body Crazy is function T return Boolean is begin return True; end T; begin raise Bang; end Crazy; with Crazy; procedure Sample is package Catch_It is new Crazy; begin null; exception when Catch_It.Bang => null; end Sample; Here is a parametrized version: generic package Crazy is type Severity_Type is (Hard, Tough, Difficult, Killer, ...); type Urgency_Type is (Urgent, Immediate, Now, Asap, ...); type Native_Code_Type is new Integer; exception Bang (Severity : Severity_Type; Urgency : Urgency_Type; Native_Code : Native_Code_Type) function T return Boolean; end Crazy; package body Crazy is function T return Boolean is begin return True; end T; begin raise Bang( Hard, Urgent, -1); end Crazy; with Crazy; procedure Sample is package Catch_It is new Crazy; begin null; exception when B : Catch_It.Bang => -- Here you'd be are able to access the values, -- but not to call anything from the already gone package. -- Regarding scope it is not any differnt from the previous -- example - we were also accessing Bang in hander. Put_Line (B.Severity); Put_Line (B.Urgency); Put_Line (B.Native_Code); end Sample; Please note that this actually works in Modula-3, but you are only limited to one parameter. Well, all languages have their warts. GNAT.Sockets is perhaps the best example how the code could benefit from parametrized exceptions. There you have Socket_Error and that's it. You need to use compiler specific tricks to extract more info. Or you can declare a coule dozen of different exceptions. Or a couple hundred, it depends. Regards, Wojtek