From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Incomplete types used with generics Date: Wed, 13 May 2015 20:14:25 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <830c0323-a06c-4884-9214-89f3ee6f17b5@googlegroups.com> <783ee7a2-e831-4e64-b736-abab0c7d71b7@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1431566066 26198 24.196.82.226 (14 May 2015 01:14:26 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 14 May 2015 01:14:26 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:25870 Date: 2015-05-13T20:14:25-05:00 List-Id: "Jeremiah" 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.