From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.0 required=3.0 tests=BAYES_20,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:ac8:538a:: with SMTP id x10mr4338598qtp.166.1612990795553; Wed, 10 Feb 2021 12:59:55 -0800 (PST) X-Received: by 2002:a25:4d08:: with SMTP id a8mr6780912ybb.465.1612990795332; Wed, 10 Feb 2021 12:59:55 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.uzoreto.com!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 10 Feb 2021 12:59:55 -0800 (PST) In-Reply-To: <82631dc2-2903-4848-b662-eb149331623cn@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: <82631dc2-2903-4848-b662-eb149331623cn@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: "end of declaration" From: Shark8 Injection-Date: Wed, 10 Feb 2021 20:59:55 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:61338 List-Id: On Wednesday, February 10, 2021 at 11:40:00 AM UTC-7, 0012... wrote: > can someone explain in simple terms what are the rules for types' "end of= declaration" ?=20 >=20 > I define a type in the private part of the package, and in the body I clo= ne it (type t_proba2 is new t_proba) to benefit from its predefined operati= ons... since it's a fixed point type I need to, or bam ! recursion... also = I want the accuracy etc to stay the same so I would do the same for floatin= g point types too.=20 >=20 > type T_Proba is delta 0.00001 range 0.0 .. 1.0;=20 > for T_Proba'Small use 0.00001;=20 >=20 > package body P_Proba2 is=20 > type t_proba2 is new T_Proba;=20 > -- type t_proba2 can't be use before the end of its declaration=20 > package Point_Fixe_io is new Ada.Text_Io.Fixed_IO(T_Proba);=20 >=20 > so I rather defined a different type with the same specifications. ugly.= =20 > no nicer way to access predefined operations for these cases ? Use more meaningful names if you can. You had "Type K is new K", which is obvious nonsense. Considering the context, I think something like > type Probability is delta 0.00001 range 0.0 .. 1.0;=20 > for Probability'Small use 0.00001; and > type Internal_Probability is new Probability; would be much better readability-/maintainability-wise