Rationale for Ada 2005
9.3.1 Aggregates for private types
The
<>
notation was introduced for aggregates to mean the default value if any.
See
4.4. A curiosity is that we can write
type Secret is private;
type Visible is
record
A: Integer;
S: Secret;
end record;
X: Visible := (A => 77; S => <>);
but we cannot write
S: Secret := <>; -- illegal
The argument is that this would be of little use
since the components take their default values anyway.
For uniformity
AI-389
proposed allowing
S: Secret := (others => <>);
for private types and
also for task and protected types. One advantage would be that we could
then write
S: constant Secret := (others => <>);
whereas at the moment it is not possible to declare
a constant of a private type because we are unable to give an initial
value.
However, discussion of this issue lead into a quagmire
concerning the related
AI-413
and in the end both were abandoned.
© 2005, 2006 John Barnes Informatics.
Sponsored in part by: