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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: no + or - defined for fixed point types in Standard, why ? Date: Thu, 25 Jan 2018 22:34:31 -0600 Organization: JSA Research & Innovation Message-ID: References: <3d796e5f-015e-469c-bbcb-edc3303793ab@googlegroups.com> <3c342468-67da-4973-a318-14e0cf1293fb@googlegroups.com> Injection-Date: Fri, 26 Jan 2018 04:34:31 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="10568"; mail-complaints-to="news@jacob-sparre.dk" 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.7246 Xref: reader02.eternal-september.org comp.lang.ada:50155 Date: 2018-01-25T22:34:31-06:00 List-Id: "Mehdi Saada" <00120260a@gmail.com> wrote in message news:3c342468-67da-4973-a318-14e0cf1293fb@googlegroups.com... > generic > type Modele is delta <>; > package P_Proba1 is > type T_Proba is private; > function "+" ( > Un, > Deux : in T_Proba ) > return T_Proba; > private > type T_proba is new MODELE range 0.1..1.0; > end P_Proba1; > > package body P_Proba1 is > function "+" > (Un, > Deux : in T_Proba) > return T_Proba is (P_Proba1."+"(UN,Deux)); > end P_Proba1; > >> program, you have to prefix by the package name that contains the >> operators : My code. > It causes infinite recursion (dixit compiler), so I didn't understand. Yup, that calls the operator you just defined, and not the original one. In this case, there is no way to get to the original operator of T_Proba; you've hidden it with the new one. (This is a common Ada programming mistake when defining operators, happens to me all the time.) You have to use some other type's "+" operator with type conversions. In this case, you might as well use the operators of Modele (which are declared with it at the formal type declaration): T_Proba (Modele (Un) + Modele (Deux)); There's a way to get at the original operator using renames, but it isn't worth the headache unless you don't have a similar type that you can convert to. Randy.