Samuel Mize wrote:
>Ben Brosgol wrote:
>> Rick's message below implies that there is some contradiction between my
>> suggestion: ...
>> and Steve Deller's observation
>I thought so too, at first, but I think he simply meant that there
>are two approaches.
>Two detail points, which I throw to the list so someone can correct
>it if I'm mistaken:
>- the indefinite private type that Ben pointed out is (I believe)
> new for Ada 95, so if you're working in Ada 83 you'll have to
> use one of the other approaches.
That is correct.
>- if the type is indefinite, you can't declare an object of that
Not quite. My original example showed how; you simply provide an
initialization with the declaration:
X : T := F(10);
where T is the private type with an unknown discriminant part, and F is a
function delivering a value of that type. This ability to declare
"unconstrained" _variables_, with the constraint obtained from the
initialization, is also new in Ada 95. In Ada 83 this was allowed only for
>Of course, the full declaration makes it definite inside
> the private parts of the package.
I think that what you mean here is that within the package, after the type's
full declaration (as an unconstrained array type) you can simply use index
constraints in declaring variables. Outside the package, since you don't
see the type as an array, you cannot apply index constraints
>But you can't have an object
> of that type outside the package.
Again, not so (see above).
>This may be a problem or a
> feature, depending on exactly what you're trying to do.
[log in to unmask]