comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Formal Subprogram Access
Date: Tue, 13 Feb 2018 18:34:33 +0100
Date: 2018-02-13T18:34:33+01:00	[thread overview]
Message-ID: <p5v7ja$vbq$1@dont-email.me> (raw)
In-Reply-To: <p5tudq$5eb$1@franka.jacob-sparre.dk>

On 02/13/2018 06:51 AM, Randy Brukardt wrote:
> 
> There's no such rule in the RM. As Christoph noted, a generic formal
> subprogram has convention Ada, 'Access is allowed. If you pass an attribute
> to it, you have to wrap it in a real subprogram for this reason. (There is a
> lot of code specifically to do this in Janus/Ada, it probably never has been
> tested outside of a single ACATS test -- I don't think anyone ever has had a
> reason to pass an attribute like Succ as a formal subprogram.)

6.3.1(9) says an attribute subprogram is Intrinsic
6.3.1(11) say you can't apply 'Access to an Intrinsic subprogram
12.6 (14) says a generic formal subprogram may be matched by an attribute function
12.6(16.2) say a generic formal subprogram with "is null" for the default, not 
matched by an explicit actual, is Intrinsic.

Since a formal subprogram may be instantiated with an Intrinsic actual, a 
generic should not be allowed to take 'Access of a formal subprogram.

> If you rename such an attribute, however, the convention stays the same, so
> 'Access isn't allowed then. But renaaming a formal subprogram certainly
> shouldn't change whether or not 'Access is allowed.

The only restriction I can see on renaming an Intrinsic subprogram deals with 
renaming-as-body, which doesn't apply here, so the renaming seems legal. 
However, as the convention of the renaming may also be Intrinsic, it seems a 
generic should be allowed to take 'Access of a renaming of a formal subprogram.

> As I said, file a bug report. Even if I'm wrong about the legality of
> 'Access on a formal subprogram, the renames should work the same way.

GNAT does instantiation as macro expansion. Might that have any effect on how 
these rules apply or when a violation is detected?

-- 
Jeff Carter
"If you don't get the President of the United States on that
phone, ... you're going to have to answer to the Coca-Cola
Company."
Dr. Strangelove
32

  parent reply	other threads:[~2018-02-13 17:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-09 22:11 Formal Subprogram Access Jeffrey R. Carter
2018-02-10  3:03 ` Randy Brukardt
2018-02-10  9:57   ` Jeffrey R. Carter
2018-02-13  5:51     ` Randy Brukardt
2018-02-13  9:24       ` AdaMagica
2018-02-13  9:41         ` Dmitry A. Kazakov
2018-02-13 10:28           ` AdaMagica
2018-02-14  0:47             ` Randy Brukardt
2018-02-14  8:19               ` Dmitry A. Kazakov
2018-02-14 10:01                 ` Jacob Sparre Andersen
2018-02-14 11:07                   ` Dmitry A. Kazakov
2018-02-13 12:24       ` Simon Wright
2018-02-14  0:53         ` Randy Brukardt
2018-02-14 14:36           ` Simon Wright
2018-02-15  4:56             ` Randy Brukardt
2018-02-15 13:12               ` Simon Clubley
2018-02-15 16:38                 ` Simon Wright
2018-02-15 18:40                   ` Simon Clubley
2018-02-15 16:19               ` Simon Wright
2018-02-15 23:03               ` Randy Brukardt
2018-02-13 17:34       ` Jeffrey R. Carter [this message]
2018-02-13 18:31         ` AdaMagica
2018-02-14  0:57           ` Randy Brukardt
2018-02-10 14:55   ` AdaMagica
2018-02-21 17:51 ` Jeffrey R. Carter
replies disabled

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