Rationale for Ada 2012

John Barnes
Contents   Index   References   Search   Previous   Next 

9.4.1 Integrated packages

Difficulties sometimes arise with nested packages. Consider for example a package that needs to export a private type T and a container instantiated for that type. We cannot write
package P is
   type T is private;
   package T_Set is new Ordered_Sets(T);
private
   ...
end P;
because the type T is not frozen. We have to write something like
package P is
   package Inner is
      type T is private;
   private
      ...
   end Inner;
   package T_Set is new Ordered_Sets(Inner.T);
end P;
What we now want is some way to say that the declarations in Inner are really at the level of P itself after all. In other words we want to integrate the package Inner with the outer package P.
Various attempts were made to solve this by another kind of use clause or perhaps by putting Inner in a <> box. But all attempts led to difficulties so this remains unresolved. (See AI-135 and AI-135-2).

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

    ARA
  AdaCore:


    AdaCore
and   Ada-Europe:

Ada-Europe