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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a78600718149068b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!g4g2000prj.googlegroups.com!not-for-mail From: troll Newsgroups: comp.lang.ada Subject: Re: tagged primitive operation and freezing Date: Mon, 15 Nov 2010 06:23:44 -0800 (PST) Organization: http://groups.google.com Message-ID: <076ebb12-e620-48b7-ab0f-cb90169d91b4@g4g2000prj.googlegroups.com> References: <878w0xr069.fsf@ludovic-brenta.org> NNTP-Posting-Host: 192.91.171.36 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1289831025 15774 127.0.0.1 (15 Nov 2010 14:23:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 15 Nov 2010 14:23:45 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: g4g2000prj.googlegroups.com; posting-host=192.91.171.36; posting-account=oVfT5woAAABM-b9_p2pX0lyTMvmsmxo_ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Lockheed Martin TSS; .NET CLR 2.0.50727; MS-RTC LM 8; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:16478 Date: 2010-11-15T06:23:44-08:00 List-Id: But only if it is tagged. untagged type, even though frozen, DOES compile. On Nov 13, 5:24=A0am, Ludovic Brenta wrote: > troll writes on comp.lang.ada: > > > > > > > generic > > =A0 type Object_T is private; > > procedure blah ( Param : Object_T ); > > > ------- > > > with blah; > > package oops is > > =A0 type a is tagged null record; =A0-- any tagged type > > > =A0-- must be a type extension to induce failure: > > =A0 type Flight_T is new a with null record; =A0-- fail > > > =A0 function b (Flight : in Flight_T) return String; > > > =A0 procedure c is new blah (Object_T =3D> Flight_T); > > > end; > > I think the reason why this is illegal is because c is a primitive > operation of Flight_T; at the same time, using Flight_T as an actual > generic parameter freezes Flight_T just before the declaration of this > new primitive operation. =A0Therefore the declaration of c is illegal. > > You can work around this by wrapping Flight_T in a package: > > generic > =A0 type Object_T is private; > procedure blah ( Param : Object_T ); > > with blah; > package oops is > =A0 type a is tagged null record; =A0-- any tagged type > > =A0 package Flight is > =A0 -- must be a type extension to induce failure: > =A0 =A0 =A0type T is new a with null record; > =A0 =A0 =A0function b (Flight : in T) return String; > =A0 end Flight; -- this freezes Flight_T > > =A0 procedure c is new blah (Object_T =3D> Flight.T); -- non-primitive > > end oops; > > -- > Ludovic Brenta.- Hide quoted text - > > - Show quoted text -