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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ea5071f634c2ea8b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.35.68 with SMTP id f4mr16324358pbj.5.1321865022905; Mon, 21 Nov 2011 00:43:42 -0800 (PST) Path: lh20ni524pbb.0!nntp.google.com!news1.google.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Generic-Package Elaboration Question / Possible GNAT Bug. Date: Mon, 21 Nov 2011 09:43:32 +0100 Organization: cbb software GmbH Message-ID: <3snehoqgs8ia$.1nobjem6g6hx6$.dlg@40tude.net> References: <7bf9bc32-850a-40c6-9ae2-5254fe220533@f29g2000yqa.googlegroups.com> <4295dc09-43de-4557-a095-fc108359f27f@y42g2000yqh.googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news1.google.com comp.lang.ada:18987 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Date: 2011-11-21T09:43:32+01:00 List-Id: On Sun, 20 Nov 2011 23:25:39 -0800 (PST), AdaMagica wrote: > On 20 Nov., 10:55, "Dmitry A. Kazakov" > wrote: >>> On Nov 19, 4:12�pm, Robert A Duff >>> wrote: >>>> In general, the design of Ada is that if a generic body is legal, >>>> then every possible instance is legal (so the compiler need not >>>> check the instances). �The design of C++ templates is very different >>>> in this regard! >> >> I don't know if Ada keeps that promise for generic bodies, but it certainly >> does not for the specifications. Generic contracts are too weak for that. >> Example: >> >> generic >> � �type T is tagged private; >> package Legal is >> � �type S is new T with null record; >> � �not overriding procedure Foo (X : in out S); >> end Legal; >> >> This and the body would successfully compile ignoring the fact that there >> might exist tagged types with a primitive operation named Foo. > > Note that Bob said this holds true for *bodies*, here you have a > *spec* that might produce an illegal instance. If the specification becomes illegal so does the body. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de