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!news3.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!newsfeed.freenet.ag!news.netcologne.de!ramfeed1.netcologne.de!newsfeed.arcor.de!newsspool3.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: Fri, 13 Aug 2010 08:27:52 +0200 Message-ID: <15e1x67lls1pe$.sqnhbm59hwdz$.dlg@40tude.net> NNTP-Posting-Date: 13 Aug 2010 08:27:50 CEST NNTP-Posting-Host: bdcae93e.newsspool2.arcor-online.net X-Trace: DXC=1kFG;ifT^2T@>[RYkFXOIPA9EHlD;3YcR4Fo<]lROoRQ8kF:1bnDlZ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:13200 Date: 2010-08-13T08:27:50+02:00 List-Id: On Thu, 12 Aug 2010 20:45:33 +0100, Simon Wright wrote: > "Dmitry A. Kazakov" writes: > >> 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. > > Not quite sure what you mean here? > > I think you're recommending that all names of generic units should > include an indication that they're generic, so that people don't get > confused as to generic vs instantiation? More important is that names of generics do not hide other names. Sooner or later it becomes a problem. > In other places I've tacked _G on the end of the 'obvious' name: > > generic > package ColdFrame.Events_G.Standard_G.Callback_Manager_G is > > and I saw someone else (Ludovic?) doing the same here recently. I used plural suffix 's' before, but it Generic is clearer and it seems like a semi-standard now. > I think that people are going to get confused instantiating children of > generic packages, and that there's nothing like a helpful example to > clarify. > > Currently I have (with elsewhere, "type Real is digits <>;") > > package Real_Arrays > is new Ada.Numerics.Generic_Real_Arrays (Real); > package Complex_Types > is new Ada.Numerics.Generic_Complex_Types (Real); > package Complex_Arrays > is new Ada.Numerics.Generic_Complex_Arrays (Real_Arrays, Complex_Types); > package Extensions > is new Complex_Arrays.Extensions; > > Do people feel this would be clearer if the last 2 lines read instead > > package Extensions > is new Complex_Arrays.Generic_Extensions; > > (and if so, how much clearer?!) Yes, especially because of two "Extensions". I had immense problems with names. Look at this: http://www.dmitry-kazakov.de/ada/fuzzy_packages.gif Somewhere down deep the hierarchy the user starts to become incomprehensive error messages upon instantiation within the generic(!) bodies. It is practically impossible to understand what is wrong, is it a compiler bug (in GNAT case) or something else. For the user it would be a nightmare to fight this. Another rule of thumb (I don't know if this is going to be fixed in Ada 2012), is that a child should always rename formal generic arguments in its specifications. Under certain circumstances, usually in children, they might become unavailable. I mean this: generic with package P is new Generic_P (<>); package Generic_S is package P_Of renames P; -- You will need this! Sometimes you need to "rename" formal types as well: generic type Foo is ... package Generic_S is subtype Foo_Of is Foo; -- What a mess! -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de