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,f93e461e8491e322 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!51g2000cwl.googlegroups.com!not-for-mail From: "Adam Beneschan" Newsgroups: comp.lang.ada Subject: Re: Limited_Controlled, orthogonality and related issues Date: 18 Jan 2007 09:16:22 -0800 Organization: http://groups.google.com Message-ID: <1169140582.275634.126300@51g2000cwl.googlegroups.com> References: <1169139744.717060.69070@51g2000cwl.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1169140597 15127 127.0.0.1 (18 Jan 2007 17:16:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 18 Jan 2007 17:16:37 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: 51g2000cwl.googlegroups.com; posting-host=66.126.103.122; posting-account=cw1zeQwAAABOY2vF_g6V_9cdsyY_wV9w Xref: g2news2.google.com comp.lang.ada:8270 Date: 2007-01-18T09:16:22-08:00 List-Id: Adam Beneschan ranted uselessly: > On looking at this, I wonder if this was an error in the design of Ada > 95. Primitive operations of tagged types are dispatching, and the > reason is that so that another package can declare a type extension > from a tagged type and inherit the dispatching operation, and possibly > override it, and then somebody could use the operation on a class-wide > type to call the correct operation for that particular object, and thus > achieve polymorphism. But when the partial view of a type is not > tagged, then other packages can't derive type extensions from it and > can't apply 'Class to it, so was there any logical reason why an > operation on that type (declared in the visible part of the package) > should be dispatching? Maybe not, since the dispatch could "almost > never" take place in practice, and since making the operation > dispatching adds restrictions just like the one Maciej found. > > I say "almost never" because in theory, since the private part or body > of P or of a child of P (or the visible part of a private child of P) > *could* derive a type extension from the tagged type and dispatch. But > I'd guess that such usage would be rare. > > So it seems to me that (1) it would have been better to say in 3.9.2 > that a primitive operation of an untagged private type whose full view > is tagged is not dispatching, at least if the operation is declared in > the visible part of the package; or (2) some way should have been > provided for the programmer to specify that an operation that 3.9.2 > defines as "dispatching" really isn't. > > Maybe (2) is still possible. I'm guessing that it's way too late to > make (1) the rule. So this is probably really just a useless rant. On reflection, maybe there *is* a way to fix this: Change the first sentence of 3.9.2(1) to read, "The primitive subprograms of a tagged type are called dispatching operations, except that a primitive subprogram of two or more tagged types is not a dispatching operation if it is declared in the visible part of a package, and every type of which the subprogram is a primitive operation is an untagged type or a tagged type whose partial view is untagged". Or something along those lines. The idea is that a change like this would have no effect on programs that are currently legal, so it seems like it should be safe. And it would make programs like Maciej's original attempt legal, as they (IMHO) should be. -- Adam