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-16 06:58:22 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Renaming an abstract function Date: 16 Nov 2001 09:52:59 -0500 Organization: NASA Goddard Space Flight Center Message-ID: References: <9t1lp1$16unne$1@ID-25716.news.dfncis.de> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1005922528 7203 128.183.220.71 (16 Nov 2001 14:55:28 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 16 Nov 2001 14:55:28 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Xref: archiver1.google.com comp.lang.ada:16627 Date: 2001-11-16T14:55:28+00:00 List-Id: "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. However, just taking the literal English meaning, an abstract function is _not_ callable, so it appears that you cannot rename an abstract function. Too bad; it would be nice here (assuming "P" is a multiplication operator :). On the other hand, it could be confusing. Is the renamed function also inherited (which is what you would want)? RM 3.2.3 says: 2. The primitive subprograms of a specific type are defined as follows: 3. The predefined operators of the type, see *Note 4.5::, 4. For a derived type, the inherited, see *Note 3.4::, user-defined subprograms; 5. For an enumeration type, the enumeration literals (which are considered parameterless functions - see *Note 3.5.1::.); 6. For a specific type declared immediately within a package_specification, any subprograms (in addition to the enumeration literals) that are explicitly declared immediately within the same package_specification and that operate on the type; I don't think a renaming declaration meets this definition, so they are not inherited. So you have to choose either "P" or "*" for the primitive operation, and provide the other name via renaming as needed for each derived type. It depends on which name is more likely to be needed. I guess my answer to your question is (c) :). -- -- Stephe