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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2478ea1b71f848e3,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.180.73.173 with SMTP id m13mr2074516wiv.4.1350603876590; Thu, 18 Oct 2012 16:44:36 -0700 (PDT) Path: q11ni134368477wiw.1!nntp.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!212.6.121.138.MISMATCH!newsfeeder.ewetel.de!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: =?utf-8?B?R05BVCBkb2luZyBtYWNyb+KAkWV4cGFuc2lvbiBmb3IgZ2VuZXJpY3M/ICg=?= =?utf-8?B?UHJlL1Bvc3QgY29uZGl0aW9ucyk=?= Date: Fri, 19 Oct 2012 01:44:29 +0200 Organization: Ada @ Home Message-ID: NNTP-Posting-Host: H5WtUSoFG7aj9zQnJ7RbaQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.02 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2012-10-19T01:44:29+02:00 List-Id: Is this GNAT doing macro=E2=80=91expansion for generics, or me missing s= ome trick = of Ada 2012? Small snippet first, then comments below (not Ada comments). -- g.ads package G is pragma Pure; type E is (E1, E2, E3); type I_Type is interface; function F (I : I_Type) return E is abstract; procedure P (I : I_Type) is abstract with Pre'Class =3D> F (I) =3D E1; end; -- m.adb with G; procedure M is type I_Type is new G.I_Type with null record; overriding function F (I : I_Type) return G.E; overriding procedure P (I : I_Type); -- subtype E is G.E; -- E1 : constant E :=3D G.E1; -- use type E; function F (I : I_Type) return G.E is (G.E1); procedure P (I : I_Type) is begin null; end; begin null; end; GNAT can compile package `G`, but while compiling `M`, complains `E1` = (from the precondition of `P` in `G`) is not visible in `M`. Un=E2=80=91= commenting = the three initially commented lines solves the issue, but still leave me= = with a feeling, things are going here as if a kind of macro=E2=80=91expa= nsion was = applying. The precondition should be compiled in the context of its = definition, isn't it? Other funny stuff: in the precondition of P, substitute `P (I)` to `F = (I)`. GNAT will compile `G` without a complain, and will only figure = something is wrong while compiling `M`. Is this GNAT's fault, or mine = missing something? Note: both occur using FSF GNAT 4.6 -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity