Rationale for Ada 2012

John Barnes
Contents   Index   References   Search   Previous   Next 

9.3.1 Aggregates for private types

The <> notation was introduced in Ada 2005 for aggregates to mean the default value if any. A curiosity is that we can write
type Secret is private;
type Visible is
      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 it was proposed that we might allow
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 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 led into a quagmire in Ada 2005 and so was abandoned. It remains abandoned in Ada 2012!

Contents   Index   References   Search   Previous   Next 
© 2011, 2012, 2013 John Barnes Informatics.
Sponsored in part by:
The Ada Resource Association:


and   Ada-Europe: