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,ea5071f634c2ea8b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.35.131 with SMTP id h3mr17275898pbj.1.1321880885034; Mon, 21 Nov 2011 05:08:05 -0800 (PST) Path: lh20ni1554pbb.0!nntp.google.com!news2.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Generic-Package Elaboration Question / Possible GNAT Bug. Date: Mon, 21 Nov 2011 08:08:04 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <7bf9bc32-850a-40c6-9ae2-5254fe220533@f29g2000yqa.googlegroups.com> <4295dc09-43de-4557-a095-fc108359f27f@y42g2000yqh.googlegroups.com> <3snehoqgs8ia$.1nobjem6g6hx6$.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1321880884 4904 192.74.137.71 (21 Nov 2011 13:08:04 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 21 Nov 2011 13:08:04 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:WTx5mpEQc3sJVG+iR32jjN5M6To= Xref: news2.google.com comp.lang.ada:14476 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: 2011-11-21T08:08:04-05:00 List-Id: "Dmitry A. Kazakov" writes: > 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, ... I think it does. I'd be interested in any counterexamples. (Implementation defined cases don't count.) >...but it certainly >>> does not for the specifications. Right. >...Generic contracts are too weak for that. Well, it's not that the contracts are too weak. You just have to consider the entire generic spec (including the private part, unfortunately), as part of the "contract". Also, the generic contract model applies only to compile-time rules. The fact that the instance body is guaranteed to be legal doesn't mean that it will work properly! And there are a few cases where we deliberately "cheat" in the RM, by making something raise an exception in a generic, when it would normally be a legality rule. >> 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. OK, but my comment was the other way around: "if a generic body is legal, then ..." - Bob