OK, I assume that you thought when you instantiated Item_Vectors
and said use Item_Vectors
, that the Vector
type in Item_Vectors
would be the completion of the incomplete Vector
you wrote earlier.
It doesn't. When you say use P
, it means that all the names defined in P
are now directly visible, so if P
declares a type T
, you can say T
instead of saying P.T
. But the symbols still belong to P. They do not become "part of" the package that contains the use
. Thus, for instance, use Item_Vectors;
means that you can say Empty_Cursor
instead of Item_Vectors.Empty_Cursor
. But there will not be a Types.Boxed.Empty_Cursor
. The name still belongs to Item_Vectors
.
What this means is that when you have an incomplete Vector
type in Types.Boxed
, there needs to be a completion in Types.Boxed
. The Vector
type in Item_Vectors
does not become the completion of the type, and the use
doesn't help with that.
Unfortunately, Ada doesn't let you complete the type with a "type rename" or a subtype
. The best option I can think of is
type Vector is new Item_Vectors.Vector with null record;
Note that this causes all the operations in Item_Vector
to be inherited for Vector
. So this might work for you. But there could be some unanticipated problems. But I can't think of a better solution.
EDIT: It looks like Simon has a good possible solution.