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: a07f3367d7,556e5b18154df788 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.66.12.135 with SMTP id y7mr3025904pab.7.1364939518063; Tue, 02 Apr 2013 14:51:58 -0700 (PDT) Path: jv11ni528pbb.0!nntp.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.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!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Interresting, possibly buggy behavior in GNAT generics w/ expression function. Date: Fri, 29 Mar 2013 17:21:39 +0100 Organization: cbb software GmbH Message-ID: <1ex3dm2hk2j54$.1uiyljwziv0hi$.dlg@40tude.net> References: <1k6ipbtagwzw4$.1dv47rfygcedg.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: XRUMb5xlbonTNodERpEXEw.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 X-Received-Bytes: 2431 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2013-03-29T17:21:39+01:00 List-Id: On Fri, 29 Mar 2013 14:45:33 +0000, Simon Wright wrote: > "Dmitry A. Kazakov" writes: > >> On Fri, 29 Mar 2013 07:45:04 +0000, Simon Wright wrote: >> >>> I don't know whether this is a language problem >> >> It is a general language problem that generic specifications and bodies >> cannot be fully checked. Matched formal parameters only is not sufficient. >> Much better than with C++ templates, but still same mess. > > 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. For example: generic type S is new T with private; package P is type Q is new S with null record; not overriding procedure Foo (X : Q); It is uncheckable if S does not have Foo already. Thus, this must be a compile error. If we wanted properly contracted generics (personally, I don't care), we would need some syntax to tell that S may not have operation Foo, e.g. generic type S is new T with private; not with procedure Foo (X : S); package P is type Q is new S with null record; not overriding procedure Foo (X : Q); -- We know S does not have this -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de