TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Mime-Version:
1.0
Sender:
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Subject:
From:
Ben Brosgol <[log in to unmask]>
Date:
Fri, 5 Feb 1999 11:34:15 -0500
Content-Transfer-Encoding:
7bit
Content-Type:
text/plain; charset="iso-8859-1"
Reply-To:
Ben Brosgol <[log in to unmask]>
Parts/Attachments:
text/plain (56 lines)
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
>  type.

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
_constants_.

>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.
>
>Best,
>Sam Mize

Regards,

Ben Brosgol
[log in to unmask]

ATOM RSS1 RSS2