comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Renaming an abstract function
Date: 19 Nov 2001 10:38:56 -0500
Date: 2001-11-19T15:41:31+00:00	[thread overview]
Message-ID: <uherqbwj3.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 3BF6DE1F.6C31A357@home.com

Mark Biggar <mark.a.biggar@home.com> writes:

> <snip example of renaming an abstract function returning an abstract
> type>

> > >    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;

> 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.
> 

Well, the full text of the AI talks about renaming an _inherited_
subprogram, not the abstract subprogram itself. It does not discuss
exactly what should happen for this case.

Simply following the rules for inheriting abstract subprograms, you
are required to give an overriding subprogram for any derived type.
Thus, if the renaming is valid, you'd have to override both P and "*",
which is surely not the intent. So it seems reasonable to conclude
that the renaming itself is invalid.

We could propose a "renaming inheritance" rule that says an equivalent
renaming is applied to the overriding subprogram; that is the intent
of this renaming.

-- 
-- Stephe



  parent reply	other threads:[~2001-11-19 15:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-15 23:52 Renaming an abstract function Nick Roberts
2001-11-16 14:52 ` Stephen Leake
2001-11-17  3:08   ` Adam Beneschan
2001-11-17 17:47     ` Egil Harald Hoevik
2001-11-17 18:33     ` Stephen Leake
2001-11-17 22:00     ` Mark Biggar
2001-11-17 23:17       ` Nick Roberts
2001-11-19 15:38       ` Stephen Leake [this message]
2001-11-22  3:14         ` Nick Roberts
2001-11-23 15:40           ` Stephen Leake
2001-11-24  3:55             ` Nick Roberts
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox