From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Incomplete types used with generics
Date: Tue, 12 May 2015 16:49:16 -0500
Date: 2015-05-12T16:49:16-05:00 [thread overview]
Message-ID: <mitsgs$1b2$1@loke.gir.dk> (raw)
In-Reply-To: 830c0323-a06c-4884-9214-89f3ee6f17b5@googlegroups.com
"Jeremiah" <jeremiah.breeden@gmail.com> wrote in message
news:830c0323-a06c-4884-9214-89f3ee6f17b5@googlegroups.com...
...
> I *think* the generic parameter "type Item_Type is tagged limited
> private;" is considered incomplete as is "type Node2_Type is tagged;".
On the the things that *I* missed is the above. No, private types aren't
incomplete, and in fact even a private type cannot be used as the actual to
a generic private type (the type is immediately frozen, but for a private
type that is illegal, as per 13.14(17)).
If you want an incomplete formal parameter, you have to write it that way.
That is:
type Item_Type is tagged;
On the other side, *anything* can be the actual to a generic formal
incomplete type. The type can be limited, incomplete, private, and/or
abstract. Of course, that means there isn't much you can do with such a type
(you'd have to pass in an allocator and deallocator subprogram, for
instance). There's somewhat more you can do with a tagged incomplete type
(in particular, you can make calls), but even that is very limiting. But of
course that's the idea; if you can live with the limitations, you get the
ability to instantiation the generic almost anywhere with any kind of type.
>> 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. :-)
Randy.
next prev parent reply other threads:[~2015-05-12 21:49 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 [this message]
2015-05-12 23:19 ` Jeremiah
2015-05-14 1:14 ` Randy Brukardt
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