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: a07f3367d7,556e5b18154df788 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.185.79 with SMTP id cn15mr11280964qab.4.1364939979049; Tue, 02 Apr 2013 14:59:39 -0700 (PDT) MIME-Version: 1.0 Path: v17ni20435qad.0!nntp.google.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.bbs-scene.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!gegeweb.org!news.ecp.fr!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Interresting, possibly buggy behavior in GNAT generics w/ expression function. Date: Fri, 29 Mar 2013 19:56:05 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <1k6ipbtagwzw4$.1dv47rfygcedg.dlg@40tude.net> <1ex3dm2hk2j54$.1uiyljwziv0hi$.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1364604970 9209 69.95.181.76 (30 Mar 2013 00:56:10 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sat, 30 Mar 2013 00:56:10 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2013-03-29T19:56:05-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:1ex3dm2hk2j54$.1uiyljwziv0hi$.dlg@40tude.net... ... >> But, do you think it should have failed at instantiation? > > It should fail to compile, instantiation time is too late. Generic > contracts are much too weak. This doesn't make much sense, as you then go on to suggest adding a formal contract which would have the effect of rejecting an instantiation if the type actually had Foo. That's exactly what Ada does, so I don't see any advantage of a complication. The problem you are having is that you are viewing the contract of a generic in too narrow of a fashion. The contract includes not only the things in the generic part, but also a number of properties expressed in the rest of the specification. After all, almost all Ada legality rules are rechecked in instance specifications, and these too have to be considered part of the contract. Randy.