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!q2g2000cwa.googlegroups.com!not-for-mail From: "Adam Beneschan" Newsgroups: comp.lang.ada Subject: Re: Limited_Controlled, orthogonality and related issues Date: 19 Jan 2007 09:04:57 -0800 Organization: http://groups.google.com Message-ID: <1169226297.096612.106410@q2g2000cwa.googlegroups.com> References: <1169139744.717060.69070@51g2000cwl.googlegroups.com> <1169140582.275634.126300@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 1169226314 19395 127.0.0.1 (19 Jan 2007 17:05:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 19 Jan 2007 17:05:14 +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: q2g2000cwa.googlegroups.com; posting-host=66.126.103.122; posting-account=cw1zeQwAAABOY2vF_g6V_9cdsyY_wV9w Xref: g2news2.google.com comp.lang.ada:8336 Date: 2007-01-19T09:04:57-08:00 List-Id: Dmitry A. Kazakov wrote: > > 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. > > I think that this idea is wrong because it fixes broken public view > [non-tagged but dispatching], by breaking the private view [non-dispatching > but tagged]. It's certainly a "hack" solution that would introduce an inconsistency into the language, but that certainly wouldn't be the first time something inconsistent was added to Ada, in order to try to fix a problem while having minimal effect on existing programs. Unless I've missed something, the hack solution I proposed would affect *only* programs that are currently illegal while having no effect on the semantics of currently legal programs, so from that standpoint I don't see how it "breaks" anything. However, now that I've seen Randy's post, I'm convinced that there are less onerous ways to get around the problem---you can arrange things so that you can declare this subprogram and still implement the full views of the types any way you wish. So there's probably less of a reason to add a "hack" like this to the language than there was when I first posted it. I think that your idea below is possibly a good reflection of how things *should* have been designed, in theory; but I think it could break existing programs if we tried to add that now. I'm afraid that not enough consideration was given to the special problems of untagged private types whose full view is tagged when Ada 95 was designed; as I recall, I've found areas of the RM that were worded in a way that made it unclear what should happen with such types. -- Adam > I think that the guiding rule should be that all views of the > same thing shall be consistent. For this reason it would be better that for > such subprograms the private view of such subprograms were class-wide: > > package > type T is limited private; > procedure Foo (X : in out T); > private > type T is new Ada.Finalization.Limited_Controlled with ...; > -- > -- Here Foo is seen as > -- > -- procedure Foo (X : in out T'Class);