5. Embedded QUEL for Ada : Ada Variables and Data Types : Variable and Type Declarations : The Discriminant and Index Constraints
 
Share this page                  
The Discriminant and Index Constraints
The discriminant and index constraints have the following syntax:
(discriminant_or_index_constraint)
In a variable declaration the syntax is:
identifier: type_name (discriminant_or_index_constraint);
Syntax Notes:
1. Even if a constraint is not allowed by Ada, it will be accepted by EQUEL. For example, both of the following constraints are accepted, even though the second is illegal in Ada because the integer type does not have a discriminant:
## who: String(1..20);-- Legal index constraint
## nat: Integer(0);   -- Illegal context for discriminant
2. The contents of the constraint contained in the parentheses are not processed. Consequently, any constraint will be accepted, even if not allowed by Ada. For example, the following declaration will be accepted by EQUEL but will generate a later Ada compiler error because of the illegal index constraint:
## password: String(secret word);
Note that the above type constraints are not discussed in detail after this section, and their rules and restrictions are considered part of the EQUEL/Ada declaration syntax.