-- The "pair of integers" from the example.
Type Pair is record
A, B : Integer;
end record;
-- The "where the second is greater than the first" constraint.
Subtype Constrained_Pair is Pair
with Dynamic_Predicate => Constrained_Pair.B > Constrained_Pair.A;
type A_T is range 1 .. 50;
subtype B_T is A_T;
B_T
实际上与类型A_T
“相同”,因为它不对其施加任何限制。它更像是类型A_T
的重命名,以方便使用。因此,您不能说Ada子类型是依赖类型。