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,9d8db3defac005a2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-17 14:00:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!nntp-relay.ihug.net!ihug.co.nz!news-hog.berkeley.edu!ucberkeley!enews.sgi.com!newshub2.rdc1.sfba.home.com!news.home.com!news1.rdc1.sfba.home.com.POSTED!not-for-mail Message-ID: <3BF6DE1F.6C31A357@home.com> From: Mark Biggar X-Mailer: Mozilla 4.78 [en]C-{C-UDP; EBM-SONY1} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Renaming an abstract function References: <9t1lp1$16unne$1@ID-25716.news.dfncis.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 17 Nov 2001 22:00:15 GMT NNTP-Posting-Host: 24.250.143.171 X-Complaints-To: abuse@home.net X-Trace: news1.rdc1.sfba.home.com 1006034415 24.250.143.171 (Sat, 17 Nov 2001 14:00:15 PST) NNTP-Posting-Date: Sat, 17 Nov 2001 14:00:15 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:16655 Date: 2001-11-17T22:00:15+00:00 List-Id: Adam Beneschan wrote: > > Stephen Leake wrote in message news:... > > "Nick Roberts" writes: > > > > > When given the program: > > > > > > package Test1 is > > > type T is abstract tagged limited private; > > > function P (X, Y: in T) return T is abstract; > > > function "*" (A, B: in T) return T renames P; -- error line > > > private > > > type T is abstract tagged limited null record; > > > end; > > > > > > GNAT 3.12p on Windows 95 returns the error message: > > > > > > function that returns abstract type must be abstract > > > > > > Is this a bug in: (a) GNAT; (b) the RM95; or (c) my brain? > > > > Same error in gnat 3.14 (you should at least upgrade to 3.13p). > > > > RM 8.5.4 (2) says: > > > > 2. subprogram_renaming_declaration ::= > > subprogram_specification renames callable_entity_name; > > > > The term "callable_entity_name" is not mentioned elsewhere in the > > reference manual, which I find odd. > > Note that "callable_entity" is in italics, while "name" is not. In RM > notation, that means that the language expects the syntax of a "name" > (defined in 4.1), while "callable_entity" is a description that tells > you what the name has to represent. I guess if you're searching a > text file version of the RM, there's probably no indication that part > of it is in italics. "callable entity" is easily found in the index. > > A "callable entity" is defined (in 6(2)) to be a subprogram or entry. > Thus an abstract subprogram is a callable entity even though you can't > really call it. > > I don't see any prohibition on renaming an abstract subprogram. > However, renaming subprograms don't quite take on all the > characteristics of the subprograms they rename; see 8.5.4(12) for > instance. I suspect that has something to do with why renaming an > abstract subprogram could lead to an error, but I don't have time > right this minute to look into it further. There is an AI that addresses this problem: >!standard 8.5.4 (7) 00-07-12 >AI95-00211/06 >!class ramification 98-11-18 >!status Response 2000 00-01-24 >!status WG9 approved 99-06-12 >!status ARG Approved (with changes) 8-0-1 99-03-24 >!status work item 98-11-18 >!priority Medium >!difficulty Easy >!qualifier Clarification >!subject Can an abstract subprogram be renamed? > >!summary > >An abstract subprogram can be renamed, and the renamed view is also >abstract. Such a renaming must appear in a place where the declaration >of an abstract subprogram would be legal. Similarly, the "shall be >overridden" >property of 3.9.3(6) applies to a renamed view. Thus, any renaming of an >inherited subprogram that must be overridden is illegal. This explains the compilation error as the renaming "*" is a must be overridden function as it has an abstract return type and thus is illegal. -- Mark Biggar mark.a.biggar@home.com