comp.lang.ada
 help / color / mirror / Atom feed
From: Mehdi Saada <00120260a@gmail.com>
Subject: "end of declaration"
Date: Wed, 10 Feb 2021 10:39:59 -0800 (PST)	[thread overview]
Message-ID: <82631dc2-2903-4848-b662-eb149331623cn@googlegroups.com> (raw)

can someone explain in simple terms what are the rules for types' "end of declaration" ?

I define a type in the private part of the package, and in the body I clone it (type t_proba2 is new t_proba) to benefit from its predefined operations... 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 floating point types too.

   type T_Proba is delta 0.00001 range 0.0 .. 1.0;
   for T_Proba'Small use 0.00001;

package body P_Proba2 is
      type t_proba2 is new T_Proba2;
-- type t_proba2 can't be use before the end of its declaration
   package Point_Fixe_io is new Ada.Text_Io.Fixed_IO(T_Proba);

so I rather defined a different type with the same specifications. ugly.
no nicer way to access predefined operations for these cases ?

             reply	other threads:[~2021-02-10 18:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 18:39 Mehdi Saada [this message]
2021-02-10 19:06 ` "end of declaration" AdaMagica
2021-02-10 19:21 ` Egil H H
2021-02-10 19:31   ` Mehdi Saada
2021-02-10 21:08     ` Shark8
2021-02-10 22:43       ` Niklas Holsti
2021-02-10 20:59 ` Shark8
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox