comp.lang.ada
 help / color / mirror / Atom feed
* "end of declaration"
@ 2021-02-10 18:39 Mehdi Saada
  2021-02-10 19:06 ` AdaMagica
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mehdi Saada @ 2021-02-10 18:39 UTC (permalink / 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 ?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-10 22:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 18:39 "end of declaration" Mehdi Saada
2021-02-10 19:06 ` 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

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