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=ham 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-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: tagged primitive operation and freezing Date: Sat, 13 Nov 2010 11:24:30 +0100 Organization: A noiseless patient Spider Message-ID: <878w0xr069.fsf@ludovic-brenta.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx03.eternal-september.org; posting-host="4lvqu01glppogpLTMdN/4g"; logging-data="22550"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yk64C0eiWnHBSHDBcECgF" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:KzhVbWz/qSCycb+bXd1AjRQ/FbU= sha1:KSh/xuAlmih9J+Itic1FAx00dWw= Xref: g2news1.google.com comp.lang.ada:15465 Date: 2010-11-13T11:24:30+01:00 List-Id: troll writes on comp.lang.ada: > generic > type Object_T is private; > procedure blah ( Param : Object_T ); > > ------- > > with blah; > package oops is > type a is tagged null record; -- any tagged type > > -- must be a type extension to induce failure: > type Flight_T is new a with null record; -- fail > > function b (Flight : in Flight_T) return String; > > procedure c is new blah (Object_T => 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. Therefore the declaration of c is illegal. You can work around this by wrapping Flight_T in a package: generic type Object_T is private; procedure blah ( Param : Object_T ); with blah; package oops is type a is tagged null record; -- any tagged type package Flight is -- must be a type extension to induce failure: type T is new a with null record; function b (Flight : in T) return String; end Flight; -- this freezes Flight_T procedure c is new blah (Object_T => Flight.T); -- non-primitive end oops; -- Ludovic Brenta.