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,16e06ab8237bab07 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.90.37 with SMTP id bt5mr4278425pab.40.1351007335366; Tue, 23 Oct 2012 08:48:55 -0700 (PDT) MIME-Version: 1.0 Path: s9ni35953pbb.0!nntp.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 23 Oct 2012 10:48:55 -0500 From: "Vincent Marciante" Newsgroups: comp.lang.ada References: <8391f2d1-b4c7-4b12-bc16-1419a1aa9739@googlegroups.com><87wqykd1wv.fsf@ludovic-brenta.org><0360d84c-ef42-4107-b837-4063da273ad8@googlegroups.com> <87r4oscx42.fsf@ludovic-brenta.org> Subject: Re: Is this a bug in Ada.Numerics? Date: Tue, 23 Oct 2012 11:48:56 -0400 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 Message-ID: <-tidnSXVvpz6IRvNnZ2dnUVZ_g6dnZ2d@earthlink.com> X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 75.99.9.146 X-Trace: sv3-SCxaJ1+q+cubW4iJl3b8QqncO5WfwslQcsA9OMACoco1XsRIlVX5XrShAPGqQluFNXQTSn3FIRT/Kbh!l8y9UCDR+KQJapBw7R4A/kOtqcqY8tE3FYKw6Y3bbmbovolo+0gJKZDmJ8Wtku+prV4sJ2/82VRo!Ltu0cOFung4gI3Q8ubHD1ovCa8GszoM= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3393 Date: 2012-10-23T11:48:56-04:00 List-Id: "Ludovic Brenta" wrote in message news:<87r4oscx42.fsf@ludovic-brenta.org>... > Leo Brewin writes: > > But having digested your answer I'm still a bit confused (sorry). Here > > is the "procedure" version of the above package, > > > > with Ada.Numerics.Generic_Complex_Types; > > with Ada.Numerics.Generic_Complex_Elementary_Functions; > > > > procedure 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); > > > > package Complex_Maths is new > > Ada.Numerics.Generic_Complex_Elementary_Functions > > (Complex_Types); > > > > procedure bar (z : in out Complex) is > > begin > > z := Complex'(Re(z),0.0); > > end bar; > > > > begin > > null; > > end foo; > > > > This does compile and yet (by my reading of your reply) the "use foo" > > and "subtype complex" lines should introduce two distinct versions of > > Complex and thus should produce a compiler error. > > The difference is that, in the procedure, the subtype Foo.Complex is > declared in the immediate scope where Complex_Maths is declared, so it > hides Foo.Complex_Types.Complex, so there is no ambiguity anymore. You > get the same effect with the package if you move the declaration of > Complex_Maths to the package spec. > > These rules are quite subtle and the error messages from GNAT less than > helpful. This is a type of comment that AdaCore's Robert Dewar really likes to address. I think that there is good chance that an improvement would be made in GNAT to address this issue if you or the original poster send a report to AdaCore. Vinny > Maybe that's why Ada has a reputation for being "difficult to > learn". > > -- > Ludovic Brenta. .