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: a07f3367d7,16e06ab8237bab07 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Received: by 10.216.211.101 with SMTP id v79mr1532260weo.9.1351391109658; Sat, 27 Oct 2012 19:25:09 -0700 (PDT) Path: q13ni70614wii.0!nntp.google.com!feeder3.cambriumusenet.nl!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.panservice.it!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Is this a bug in Ada.Numerics? Date: Sun, 21 Oct 2012 03:54:28 +0200 Organization: Ada @ Home Message-ID: References: <8391f2d1-b4c7-4b12-bc16-1419a1aa9739@googlegroups.com> NNTP-Posting-Host: apY2NFb1IfFHNqEFYZOnPA.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-21T03:54:28+02:00 List-Id: Hi, Just reading your snippet (not tried to compile) Le Sun, 21 Oct 2012 02:37:36 +0200, Leo Brewin = a =C3=A9crit: > In the course of my dabblings in Ada I've come across a curious = > "behaviour" that seems to me, with my limited knowledge of Ada, to be = a = > bug. > > Here is a simple package spec > > with Ada.Numerics.Generic_Complex_Types; > with Ada.Numerics.Generic_Complex_Elementary_Functions; > > package foo is > > type Real is digits 18; > = > package Complex_Types is new > Ada.Numerics.Generic_Complex_Types (Real); > > use foo.Complex_Types; > -- subtype Complex is foo.Complex_Types.Complex; > procedure bar (z : in out Complex); > end foo; When you do =E2=80=9Cuse foo.Complex_Types;=E2=80=9D, you introduce from= then in the = current scope, all definitions from =E2=80=9Cfoo.Complex_Types=E2=80=9D.= (by the way, you = don't need =E2=80=9Cuse foo.Complex_Types;=E2=80=9D, as =E2=80=9Cuse Com= plex_Types;=E2=80=9D would be = enough). This means that =E2=80=9Cfoo.Complex_Types.Complex=E2=80=9D [1]= is introduced in = the scope, so there is a clash with the subtype you define right after. = = May be you did not understood what exactly =E2=80=9Cuse=E2=80=9D do? [1] See [G.1.1 Complex = Types](http://www.adaic.org/resources/add_content/standards/05rm/html/RM= -G-1-1.html), = which contains the following: type Complex is [=E2=80=A6] > and the package body > > package body foo is > > package Complex_Maths is new > Ada.Numerics.Generic_Complex_Elementary_Functions = > (Complex_Types); > procedure bar (z : in out Complex) is > begin > z :=3D Complex'(Re(z),0.0); > end bar; > > end foo; Not part of the case, but here, you are instantiating a generic package = = which you don't use (must be an error). -- = =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