Version 1.2 of acs/ac-00210.txt

Unformatted version of acs/ac-00210.txt version 1.2
Other versions for file acs/ac-00210.txt

!standard 4.3.3(20)          11-01-28 AC95-00210/01
!class confirmation 11-01-28
!status received no action 11-01-28
!status received 10-10-01
!subject Subaggregate that is a string literal of length 0 or 1
!summary
!appendix

!topic Subaggregate that is a string literal of length 0 or 1
!reference Ada 2005 RM4.3.3(20)
!from Thomas Quinot 2010-10-01
!keywords subaggregate string literal length
!discussion

4.3.3(20) states:
"A subaggregate that is a string_literal is equivalent to one that is
 a positional_array_aggregate of the same length, with each expression
 being the character_literal for the corresponding character of the
 string_literal."

This definition does not work if the string literal has length 0 or 1,
since a positional_array_aggregate [without an OTHERS choice] has at
least two elements.

I think we need to allow string_literal as a valid array_aggregate,
and spell out the dynamic semantics of these aggregates in specific
clauses distinct from positional or named aggregates.

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

From: Bob Duff
Sent: Friday, October 1, 2010  7:47 AM

I'm not sure about that.  Yes, the syntax rules disallow 0- and 1-element
positional aggregates (annoyingly!).  But I think this equivalence rule should
be understood semantically.

That is, imagine there were some syntax for the 0 and 1 cases.
Do the semantic rules for positional aggregates make sense in that case?  If so,
all is well.  If not, we should fix them, and add an AARM note saying "These
rules need to make sense for the 0 and 1 cases, even though they are
syntactically illegal, because...".

(By "semantic rules" above, I guess I mean everything besides syntax -- "Static
Semantics", "Legality Rules", "Name Res.", "Dynamic Semantics", whatever else
exists.)

I'm not sure any fix is needed, but if there is, I don't think spelling out the
rules separately for string literals is a good idea.

P.S. I remember sending a similar comment in Ada 83 days, complaining that this
equivalence rule makes no sense. Great minds think alike!  ;-)  Anyway, I'm
reluctant to fix things that have been (arguably) broken for decades without any
ill effect.  We have no regression test suite that we can run on the RM.  ;-)

P.P.S. I still long for the far future day when we will wise up and allow 0- and
1-element positional aggregates!

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

From: Thomas Quinot
Sent: Friday, October 1, 2010  8:12 AM

Yes, maybe that's a viable path, but in that case we would need to introduce a
semantic definition of what a positional aggregate is -- and say that for the
particular case of positional aggregates with two or more elements, this
coincides with the syntactic non-terminal positional_array_aggregate.

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

From: Adam Beneschan
Sent: Friday, October 1, 2010  10:49 AM

I think that a "To be honest" comment in the AARM might be enough to address
this issue.  I do a lot of nitpicking about slightly-less-than-100%-clear
wording, but this one doesn't strike me as a real problem.  I think I'd
auomatically interpret 4.3.3(20) the way Bob does---that it's equivalent to what
a positional_array_aggregate *would* mean if we didn't have special syntax rules
disallowing them.

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


Questions? Ask the ACAA Technical Agent