Thu, 4 Feb 1999 09:18:27 -0600
Rick Duley wrote:
> 1. It doesn't appear to be possible to compile the declaration of an
> unconstrained type as either private or limited private. I haven't been
> able to find a prohibition of this in the LRM. Is this a compiler problem
> (GNAT 3.1)?
I can't cite ARM chapter/verse, but I can see that this can't be done.
The problem is that you could then try to declare a variable of the
private type, but there's no way to give it its array bounds. For
package A is
type A_Type is private;
type A_Type is array (integer range <>) of Integer;
procedure Uses_A is
My_A_Type: A.A_Type; -- what are the array bounds?
One solution is to have the bounds (or just the upper bound) be
discriminants to the private type. This will force you to use a
record type for the full view:
package A is
type A_Type (Count: Integer) is private;
type Int_Array is array (Integer range <>) of Integer;
type A_Type (Count: integer) is record
A_Field: Int_Array (1..Count);
You could also have A_Type be an access to objects of type
Int_Array. That way you wouldn't need to have the array
bounds be part of the public view.
If this doesn't fill the bill, you may have to rethink your data
design. I'm not sure how you intend to use a private but
For chapter and verse, I suspect you should be checking for references
about unconstrained or indefinite types.
I hope this helps.
Samuel Mize -- [log in to unmask] (home email) -- Team Ada
Fight Spam: see http://www.cauce.org/ \\\ Smert Spamonam