[Home] [Prev] [Next] [Index]

J.4 The Constrained Attribute

J.4 The Constrained Attribute

Static Semantics

1
For every private subtype S,

1.a
Discussion:  including a generic formal private subtype

the following attribute is defined:

2
S'Constrained Yields the value False if S denotes an unconstrained nonformal private subtype with discriminants; also yields the value False if S denotes a generic formal private subtype, and the associated actual subtype is either an unconstrained subtype with discriminants or an unconstrained array subtype; yields the value True otherwise.  The value of this attribute is of the predefined subtype Boolean.

2.a
Reason: Because Ada 9X has unknown_discriminant_parts, the Constrained attribute of private subtypes is obsolete. This is fortunate, since its Ada 83 definition was confusing, as explained below.  Because this attribute is obsolete, we do not bother to extend its definition to private extensions.

2.b
The Constrained attribute of an object is not obsolete.

2.c
Note well: S'Constrained matches the Ada 9X definition of "constrained" only for composite subtypes.  For elementary subtypes, S'Constrained is always true, whether or not S is constrained. (The Constrained attribute of an object does not have this problem, as it is only defined for objects of a discriminated type.) So one should think of its designator as being 'Constrained_Or_Elementary.



[Home] [Prev] [Next] [Index]

documentation@rational.com
Copyright © 1993-1998, Rational Software Corporation.   All rights reserved.