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=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:764f:: with SMTP id z76-v6mr8675241itb.11.1523020955642; Fri, 06 Apr 2018 06:22:35 -0700 (PDT) X-Received: by 2002:a9d:29d2:: with SMTP id g18-v6mr1450659otd.5.1523020955442; Fri, 06 Apr 2018 06:22:35 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!peer03.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!k65-v6no530437ita.0!news-out.google.com!15-v6ni445itg.0!nntp.google.com!u184-v6no520636ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 6 Apr 2018 06:22:35 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=194.39.218.10; posting-account=3cDqWgoAAAAZXc8D3pDqwa77IryJ2nnY NNTP-Posting-Host: 194.39.218.10 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1d9faa0f-d3d7-4eb4-aa88-b50ed1e9aac3@googlegroups.com> Subject: Generic library design From: Marius Amado-Alves Injection-Date: Fri, 06 Apr 2018 13:22:35 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2336 X-Received-Body-CRC: 3175880054 Xref: reader02.eternal-september.org comp.lang.ada:51352 Date: 2018-04-06T06:22:35-07:00 List-Id: Hello hive mind. Designing a few generic libraries involving real and complex number types and arrays thereof. Undecided as to the type of generic parameter(s). Namely: When should the parameter(s) be the base real type like (examples drawn from the standard, please extrapolate) generic type Real is digits <>; package Ada.Numerics.Generic_Real_Arrays is ... with the necessary sidekicks e.g. Generic_Elementary_Functions instantiated internally, when should it be one or more packages like generic with package Real_Arrays is new Ada.Numerics.Generic_Real_Arrays (<>); use Real_Arrays; with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real); use Complex_Types; package Ada.Numerics.Generic_Complex_Arrays is ... with the set or a subset of the necessary entities "pre-instantiated" by the user? Is there a design "rule"? Consider the running example: why is Ada.Numerics.Generic_Complex_Arrays parametrized by packages, instead of just a Real type and then instantiate the packages intarnally? And are compilers smart enough to merge identical instances w.r.t. to their generic arguments? Maybe with help of qualification pragmas telling there is no state? No need to answer to all questions at once:-) Thanks a lot.