Version 1.1 of ai05s/ai05-0006-1.txt

Unformatted version of ai05s/ai05-0006-1.txt version 1.1
Other versions for file ai05s/ai05-0006-1.txt

!standard 3.5(13)          06-03-17 AI05-0006-1/01
!class Amendment 05-10-24
!status work item 06-03-17
!status received 05-10-02
!priority Low
!difficulty Easy
!subject Nominal subtypes for all names
!summary
(See proposal.)
!problem
Not all names have nominal subtypes defined. This causes issues when legality rules depend on the nominal subtype. Consider:
subtype S is Integer range 1 .. 10; case S'Last is when 0 => -- OK? ...
Since the nominal subtype of S'Last isn't defined, we can't determine whether 0 is allowed as a discrete choice, since that depends on the nominal subtype of the case expression.
Similar issues arise for everything that is defined as a name but does not define a nominal subtype; this includes at least a variety of attributes and enumeration literals.
!proposal
Define nominal subtypes for these things (and make sure that there aren't other things that also need subtypes defined).
!wording
(TBD.)
!discussion
!example
(See problem.)
!ACATS test
An ACATS C-Test should be created to test these cases.
!appendix

From: Tucker Taft
Date: Sunday, October  2, 2005  8:08 PM

I bumped into an interesting situation recently,

     case S'Last is
       when 0 =>  -- error: choice shall cover only values of
                  --        the nominal subtype
         ...

Our compiler had decided the nominal subtype of S'Last
was S, and zero wasn't a value of the subtype S.
But there isn't any definition of what is the
nominal subtype of attributes.  If S turns out to
be a null subtype, then clearly neither S'Last nor
S'First will be a value of subtype S.  So I came to
the conclusion that the nominal subtype of an
attribute like S'Last or S'First would be S'Base.
But it really ought to say that somewhere.  Similar
questions arise for enumeration literals and other
things that happen to be "Name"s but for which there
is no defined nominal subtype.

Any thoughts?

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

Questions? Ask the ACAA Technical Agent