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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,103b407e8b68350b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-17 08:28:47 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.media.kyoto-u.ac.jp!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!fu-berlin.de!uni-berlin.de!dialin-145-254-038-248.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Anybody in US using ADA ? One silly idea.. Date: Fri, 17 Jan 2003 17:28:09 +0100 Organization: At home Message-ID: References: <1041908422.928308@master.nyc.kbcfp.com> <1041997309.165001@master.nyc.kbcfp.com> <1042086217.253468@master.nyc.kbcfp.com> <1042477504.547640@master.nyc.kbcfp.com> <1042651417.215661@master.nyc.kbcfp.com> <3E2780AB.23BDD226@adaworks.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-038-248.arcor-ip.net (145.254.38.248) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1042820926 24375040 145.254.38.248 (16 [77047]) User-Agent: KNode/0.7.1 Xref: archiver1.google.com comp.lang.ada:33139 Date: 2003-01-17T17:28:09+01:00 List-Id: Richard Riehle wrote: > "Dmitry A. Kazakov" wrote: > >> They are not, up to some limit. But the problem is whether the language >> gives you an opportunity to define new numeric types without the >> restrictions you do not need and close enough to the theoretical >> performance limit for the remaining restrictions. Ada almost can this. >> [Almost, because one cannot make a private type "numeric" for the >> compiler.] > > In fact, I have a generic package, for creating generic formal package > parameters that looks like this: > > generic > type Item is private; > with function "+" (L, R : Item) return Item is <>; > with function "-" (L, R : Item) return Item is <>; > with function "*" (L, R : Item) return Item is <>; > with function "/" (L, R : Item) return Item is <>; > with function "=" (L, R : Item) return Boolean is <>; > with function "<" (L, R : Item) return Boolean is <>; > with function ">" (L, R : Item) return Boolean is <>; > with function "<=" (L, R : Item) return Boolean is <>; > with function ">=" (L, R : Item) return Boolean is <>; > with function Zero_Equivalent return Item; > -- with some additional generic formal subprogram parameters > package Generic_Operators is end Generic_Operators; > > This can be used in some other package as a generic formal package > parameter. > > generic > with package Operators is new Generic_Operators<>; > package Generic_Statistics is > > -- Any data type here > > end Generic_Statistics; > > I published an article with the details for this in an old issue of > Ada Letters. BTW, did you compare generic with package Operators is new Generic_Operators <>; package Generic_Statistics is ... with a child package variant: generic package Generic_Operators.Generic_Statistics is ... It would be interesting to do it in depth. -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de