Version 1.1 of ais/ai-00436.txt

Unformatted version of ais/ai-00436.txt version 1.1
Other versions for file ais/ai-00436.txt

!standard 13.5.1(8)          05-09-16 AI95-00436/01
!class binding interpretation 05-09-16
!status Amendment 200Y 05-09-16
!comment This AI is in the Amendment, but it not yet approved.
!status work item 05-09-16
!subject Record representation clauses for limited record types
!summary
Record representation clauses are allowed for limited record types.
!question
13.5.1(8) forbids record representation clauses for limited (record) types. The AARM doesn't give any explanation for this restriction, which is an incompatibility with Ada 83.
Is this restriction intentional? (No.)
!recommendation
(See wording.)
!wording
Change 13.5.1(8) to read:
"The first_subtype_local_name of a record_representation_clause shall denote a specific record or record extension subtype."
!discussion
There is no documentation in the AARM of either the incompatibility or the reason for this rule. Nor can the Ada 9X team remember why this rule is there.
In practice this restriction can be a nuisance: it is perfectly reasonable to make a record type limited (for instance to force passing by reference, or simply to disallow assignment at the application level) while wanting to ensure that it gets a fixed layout: the type might be passed to another language, or it might be written to a stream or a file.
Considering that there is no known justification for this restriction, that it is an incompatibility with Ada 83, and that it can cause trouble in real programs, we are removing it.
Note that this AI as a binding interpretation to Ada 95, so implementers are invited to change their implementation to reflect the change. Of course, the change will also be part of Amendment 1.
!corrigendum 13.5.1(8)
Replace the paragraph:
The first_subtype_local_name of a record_representation_clause shall denote a specific nonlimited record or record extension subtype.
by:
The first_subtype_local_name of a record_representation_clause shall denote a specific record or record extension subtype.
!ACATS test
A C-test checking that a such a clause is allowed on a limited record is possible.
!appendix

From: Pascal Leroy
Sent: Tuesday, September 13, 2005  9:27 AM

As you are surely aware, one of the things that we tried to do in Ada 2005
was to make the limited types more useful.

I recently ran into a pesky little restriction regarding limited types:
13.5.1(8) forbids record representation clauses for limited (record)
types.  The AARM doesn't give any explanation, and neither Bob nor Tuck
can remember why this rule (which is an incompatibility with Ada 83) is
there.  Bob said "I had forgotten this, too", and Tuck, after explaining
that "at the time we all agreed that limited types were useless",
concluded "blow [this restriction] away, the sooner the better".

Before doing that, I would like to know if anyone has an objection, or
knows of a concrete reason why this rule would need to stay?

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

From: Robert Dewar
Sent: Wednesday, September 14, 2005  3:11 AM

> Bob said "I had forgotten this, too", and Tuck, after explaining
> that "at the time we all agreed that limited types were useless",

well this is hardly a reason for this useless restriction!

> concluded "blow [this restriction] away, the sooner the better".

I would just declare this a mistake and fix it even in Ada 95.

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

From: Pascal Leroy
Sent: Wednesday, September 14, 2005  4:03 AM

Interesting.  I was starting to feel that way, too.  Many/most users are
not going to move to Ada 05 for years, and there is no point in keeping
this silly incompatibility just to annoy them.  But I am unsure what is
the proper official way to handle this.  This seems similar to the
permission to use 8-bit characters in Ada 83.  How was it handled at the
time?

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

From: Robert Dewar
Sent: Wednesday, September 14, 2005  5:17 AM

no, 8 bit chars required allowing an upwards incompatible change to
Ada 83, so was much more contentious.

This is just an ordinary BI, when we said "not limited" here, we meant
"including limited" :-) :-)

If we don't require acceptance, just allow it, then it can't cause trouble.

Or, how about a more dramatic AI:

any upwards compatible change for Ada 2005 may be implemented freely in
Ada 95 compilers ...

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

From: Tucker Taft
Sent: Wednesday, September 14, 2005 10:51 AM

I presume you just issue an AI that is a binding interpretation,
rather than an amendment.

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

From: Robert Dewar
Sent: Wednesday, September 14, 2005  9:37 PM

exactly, no big deal!

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

From: Randy Brukardt
Sent: Wednesday, September 14, 2005  4:16 PM

> This is just an ordinary BI, when we said "not limited" here, we meant
> "including limited" :-) :-)

Right, this can just be an ordinary BI. OTOH, it's easier to process it as a
correction to AI-287 (a limited type restriction that we forgot to remove),
as that doesn't require a separate AI and letter ballot.

But, as this seems to be an unintentional incompatibility with Ada 83 (it's
not documented as an incompatibility in the Ada 95 AARM, thus I say
"unintentional" - Ada 83 doesn't even seem to require that the type is a
record type, much less require that it be nonlimited), and there is no
reason given, it's probably better to take the longer route and process it
as a BI with its own AI.

> If we don't require acceptance, just allow it, then it can't
> cause trouble.

Well, in theory we could enforce approved BIs in the ACATS, but it seems
unlikely that we'd spend much effort on that when there are lots of big new
things that need testing.

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


Questions? Ask the ACAA Technical Agent