Version 1.1 of ais/ai-00054.txt

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

!standard 03.05.10 (02)          97-04-11 AI95-00054/02
!class binding interpretation 95-06-25
!status WG9 approved (8-0-0) 97-07-04
!status ARG approved (6-1-0) 97-04-11
!status work item 95-10-21
!status received 95-06-25
!priority Low
!difficulty Easy
!subject When is a Small clause allowed?
!summary 95-06-25
A Small clause is illegal for a decimal fixed point type. A Small clause is illegal for a derived fixed point type.
!question 95-06-25
3.5.9(8) says, "For a type defined by an ordinary_fixed_point_definition (an ordinary fixed point type), the small may be specified by an attribute_definition_clause (see 13.3)".
3.5.10(2) says, "Small may be specified for nonderived fixed point types via an attribute_definition_clause (see 13.3)".
13.3(5) says, "An attribute_designator is allowed in an attribute_definition_clause only if this International Standard explicitly allows it".
What is the intent? May Small be specified for a derived fixed point type? (No.) May it be specified for a decimal type? (No.)
!recommendation 95-06-25
A Small clause is illegal for a decimal fixed point type. A Small clause is illegal for a derived fixed point type.
!wording 95-06-25
!discussion 95-06-25
The intent was to disallow a Small clause for a decimal type, because the Small is determined by the type declaration.
The intent was to also disallow a Small clause for a derived fixed point type, because otherwise the model numbers of the parent and derived types might differ, resulting in semantic difficulties.
!appendix

!section 03.05.10(2)
!subject: Limitations on specifying attribute small
!reference as: 95-5152.a Michael Hirasuna 95-6-11>>

!reference RM95-03.05.10(2)

!from: Michael Hirasuna 95-06-11

!keywords: attribute small, nondecimal types, nonderived fixed point types

!discussion:

The last sentence of this paragraph implies that attribute small cannot be
specified for a derived fixed point type. The sentence in question is as
follows:

"Small may be specified for nonderived fixed point types via an
attribute_definition_clause (see 13.3); the expression of such a clause
shall be static."

I don't recall seeing in 13.3 any "nonderived" requirement for specifying
attribute small. There is, however, a requirement that the type be
nondecimal, 3.5.9(8). Perhaps the word "nonderived" in paragraph 3.5.10(2)
should have been "nondecimal".


Mike  (hirasuna@acm.org)



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

!section 3.5.10(2)
!subject When is a Small clause allowed?
!reference RM95-03.05.10(2)
!reference 95-5152.a Michael Hirasuna 95-6-11
!reference AI95-00054/00
!from Keith Thompson 95-07-08
!reference as: 95-5212.a Keith Thompson 95-7-8>>
!discussion

> The intent was to also disallow a Small clause for a derived fixed point
> type, because otherwise the model numbers of the parent and derived
> types might differ, resulting in semantic difficulties.

What are these semantic difficulties?  Since derived types are distinct
types, the only way to get from one type to the other is via an explicit
or implicit type conversion.  This is no more of a problem for derived
types than for unrelated fixed-point types with different values for
'Small, for which numeric type conversions must already be supported.

As far as I can tell, this restriction does not exist in Ada 83.
At least one Ada 83 compiler, RISCAda, does support Small clauses for
derived fixed point types (as does GNAT 2.06, by the way).

I believe this restriction is both unnecessary and gratuitously
incompatible with Ada 83.

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

!section 03.05.10(02)
!subject When is a Small clause allowed?
!reference RM95-03.05.10 (02)
!reference AI95-00054
!from Pascal Leroy 95-10-20
!reference 95-5359.e Pascal Leroy 95-10-20>>
!discussion

"A Small clause is illegal for a derived fixed point type."

But wait, a small clause _was_ allowed in Ada 83 for a derived fixed point
type.  Granted, the RM was extremely unclear, but AI83-00099 stated that "a
representation clause specifying small for a derived fixed point type is
allowed if the resulting model numbers are (representable) values of the
parent type."  This was later confirmed by AI83-00138.

So by forbidding small clauses for derived fixed point types we are
introducing an incompatibility; this is a bit strange considering that the
code to support such clauses is already in Ada 83 compilers...


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

Questions? Ask the ACAA Technical Agent