Version 1.2 of ai12s/ai12-0094-1.txt

Unformatted version of ai12s/ai12-0094-1.txt version 1.2
Other versions for file ai12s/ai12-0094-1.txt

!standard 8.3(6)          14-10-13 AI05-0094-1/01
!standard 8.3(26/3)
!class binding interpretation 13-11-12
!status work item 13-11-12
!status received 13-11-05
!priority Medium
!difficulty Easy
!qualifier Omission
!subject access_to_subprogram_definition should be a declarative region
!summary
An access_to_subprogram_definition is a declarative region.
!question
Is the following legal?
type T is access function (A : Integer) return access function (A : Float) return Boolean;
One might expect that it is legal, but according to RM "8.1 Declarative Region" there is a declarative region for T and two declarations of A immediately within it, which is illegal by 8.3(26/2).
Should we change the definition of "declarative region" to include an access_to_subprogram_definition? (Yes.)
!recommendation
(See Summary.)
!wording
Add after 8.1(6):
7.1 * an access_to_subprogram_definition
[Editor's Note: This isn't quite right, as we'd have to adjust the punctuation of 8.1(6) from a period to a semicolon and add a period to the above.]
!discussion
This clearly seems like an oversight.
GNAT allows this example (it thinks it is legal).
!ASIS
Not my job.
[Editor's note: :-). I don't know ASIS well enough to know if this has a visible effect or not, so I would have left it as **TBD and asked J-P.]
!ACATS test
Not worth testing.
[Editor's note: Probably should have an ACATS C-Test like the original question, but it isn't very high priority.]
!appendix

From: Bob Duff
Sent: Tuesday, November 5, 2013  7:13 AM

Maxim Reznik (reznik@adacore.com) noticed this issue.

Is the following legal?

type T is
 access function (A : Integer) return
 access function (A : Float) return Boolean;

I'd think it should be legal, but according to RM "8.1 Declarative Region"
there is a declarative region for T and two declarations of A immediately
within it, which is illegal by 8.3(26/2).

Should we change the definition of "declarative region" to include an
access_to_subprogram_definition?

GNAT says it's legal.

****************************************************************

From: Tucker Taft
Sent: Tuesday, November 5, 2013  8:54 AM

> ... Should we change the definition of "declarative region" to include 
> an access_to_subprogram_definition?

Yes, I would agree with that change.

****************************************************************

From: Steve Baird
Sent: Tuesday, November 5, 2013  11:27 AM

Sounds right to me too.

Without this change there would also be questions about factored lists, as in

    procedure P (X, Y : access procedure (Z : in out Integer));

Is there one Z here or two? Pick your poison; without the proposed change
either answer has unpleasant consequences (either the normal equivalence breaks
down or we reject a case where the identifier Z only occurs once (textually)
in the source).

****************************************************************

From: Erhard Ploedereder
Sent: Tuesday, November 5, 2013  4:04 PM

> Should we change the definition of "declarative region" to include an 
> access_to_subprogram_definition?

Yes, of course. Clearly an oversight in the LRM.

****************************************************************

Questions? Ask the ACAA Technical Agent