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: 103376,5c1125c290d9dd14 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: ANN: Ada 2005 Math Extensions, 20100810 release Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Thu, 12 Aug 2010 07:57:39 +0200 Message-ID: NNTP-Posting-Date: 12 Aug 2010 07:57:38 CEST NNTP-Posting-Host: 5318184f.newsspool3.arcor-online.net X-Trace: DXC=E4SQ@]^H78^1`E>oC;JXEZMcF=Q^Z^V3X4Fo<]lROoRQ8kF On Wed, 11 Aug 2010 22:38:46 +0100, Simon Wright wrote: > I was thinking about the next release, and contemplating > > -- Obtain the eigenvalues of a non-symmetric real matrix. > function Eigenvalues (A : Real_Matrix) return Complex_Vector; > > It's easy enough to implement this in > Ada.Numerics.Generic_Complex_Arrays.Extensions, but it seems slightly > more natural to put it into Ada.Numerics.Generic_Real_Arrays.Extensions. > > However, I'm puzzled about how to get Complex_Vector in there, because > it's declared in Generic_Complex_Arrays (and of course you'd want to use > the same instantiation throughout, not a local one). > > Starting from the declaration of Generic_Complex_Arrays, I arrived at > > with Ada.Numerics.Generic_Complex_Arrays; > with Ada.Numerics.Generic_Complex_Types; > > generic > with package Complex_Types is new Ada.Numerics.Generic_Complex_Types > (Real); > with package Complex_Arrays is new Ada.Numerics.Generic_Complex_Arrays > (Generic_Real_Arrays, Complex_Types); -- <<<<<<<<<<<<<<<<<< > use Complex_Arrays; > package Ada.Numerics.Generic_Real_Arrays.Extensions is > > function Eigenvalues (A : Real_Matrix) return Complex_Vector; > > end Ada.Numerics.Generic_Real_Arrays.Extensions; > > but GNAT complains about Generic_Real_Arrays where I've indicated, > saying it expects a package instance to instantiate a formal. > > I'd been hoping that -- in the context of a child of > Generic_Real_Arrays -- the name would mean 'the current instantiation', > but clearly not (GNAT GPL 2010, GCC 4.5.0). AFAIK it does not work, I tried something similar before. You cannot name the parent package instance in the generic child declarations. > Any thoughts? (as always the first thought is: what a mess generics are! (:-)) I would not do that. It would only make instantiation tricky. Generic_Complex_Arrays already has all types involved, so for the end user it is much simpler when the extension package were its child. Further I would name it generic package Ada.Numerics.Generic_Complex_Arrays. Generic_Real_Extensions; ^^^^ or Generic_Real_Valued_Extensions; ^^^^^ It is always helpful to keep all name spaces clean of generic names. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de