comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Incomplete types used with generics
Date: Wed, 13 May 2015 20:14:25 -0500
Date: 2015-05-13T20:14:25-05:00	[thread overview]
Message-ID: <mj0sth$pim$1@loke.gir.dk> (raw)
In-Reply-To: 783ee7a2-e831-4e64-b736-abab0c7d71b7@googlegroups.com

"Jeremiah" <jeremiah.breeden@gmail.com> wrote in message 
news:783ee7a2-e831-4e64-b736-abab0c7d71b7@googlegroups.com...
> On Tuesday, May 12, 2015 at 5:49:18 PM UTC-4, Randy Brukardt wrote:
>> >> What am I missing?
>>
>> That you didn't use an incomplete formal type, so OF COURSE the compiler
>> rejected your instantiation with an incomplete type. Sorry about missing
>> that yesterday; I was so excited that someone would actually try to use 
>> an
>> incomplete formal that I failed to notice that you didn't actually do so.
>> One does not think clearly when you are gloating. :-)
>>
> Do I at least get points for "trying" to use an incomplete formal?

Of course. That's what caused my gloating. :-)

> Thanks for the explanation.  That makes better sense to me.  I didn't 
> realize
>private types couldn't be incomplete types (I'm sure I read it in the RM, 
>but
>I tend to learn better through trial/error then rereading than simply first 
>pass
>reading).

Private types have more capabilities than incomplete types, so it follows 
that the actual could not be incomplete.

> I've always seen the use limited private on generic parameters in most 
> examples
> and tutorials.  Does removing the "limited private" from the generic 
> parameters
> prevent me from having certain kinds of input types?

That's backwards.

> I.E. does
>
> generic
>   type Item_Type(<>) is tagged limited private;
>
> VS
>
> generic
>   type Item_Type(<>) is tagged;
>
> prevent me from using any specific types as input types to the package?

No, it's the other way around. "is tagged limited private" requires the 
actual type to be a full type, a concrete type (not abstract) and a tagged 
type. "is tagged" only requires a tagged type (it could be private or 
incomplete, or an abstract type).

For Ada before Ada 2012, formal "limited private" was the most general thing 
available for a generic (thus the use in books and the like), but formal 
incomplete types are more general than that. Of course, they can only be 
used like an incomplete type, and that is very limiting. It's not yet clear 
that much beyond signature packages can be created with them.

                                           Randy.


  reply	other threads:[~2015-05-14  1:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11 22:37 Incomplete types used with generics Jeremiah
2015-05-12  1:43 ` Randy Brukardt
2015-05-12  7:33   ` Simon Wright
2015-05-12 11:48     ` Jeremiah
2015-05-12 11:46   ` Jeremiah
2015-05-12 21:49 ` Randy Brukardt
2015-05-12 23:19   ` Jeremiah
2015-05-14  1:14     ` Randy Brukardt [this message]
2015-05-14 20:48       ` Jeremiah
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox