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.59.229 with SMTP id c5mr10332308pbr.6.1321782957251; Sun, 20 Nov 2011 01:55:57 -0800 (PST) Path: h5ni13015pba.0!nntp.google.com!news2.google.com!goblin3!goblin1!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: Sun, 20 Nov 2011 10:55:54 +0100 Organization: cbb software GmbH Message-ID: 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: IhkZcqosmjDYmkmRk7+6yg.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: news2.google.com comp.lang.ada:14470 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Date: 2011-11-20T10:55:54+01:00 List-Id: On Sat, 19 Nov 2011 15:36:33 -0800 (PST), Shark8 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! > > *nod* -- I understand that Ada's generics are quite different than C+ > +'s templates. Some of the reasons I've come across make a whole lot > more sense to me for the Ada model than the C++, this "every possible > instance" restriction is one such case. Who would want a system where > a 'general' feature only worked for *some* instances. {Meaning the > general feature wasn't actually .} 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. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de