comp.lang.ada
 help / color / mirror / Atom feed
* why "unconstrained subtype in component declaration" while said component given default value ?
@ 2018-05-26 21:03 Mehdi Saada
  2018-05-26 21:40 ` Jere
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Mehdi Saada @ 2018-05-26 21:03 UTC (permalink / raw)


Hello.
Why is this case not allowed ? Is there really an implementation issue here ? I doubt so. Why should it be any different from the non-issue of initializing variables of unconstrained subtypes vs declaring uninitialized variables of constrained subtypes ?
 type A (N: Positive) is record
      II : Integer;
      Chaine : String := Give_String(N);
   end record;

Also, there's something that would be really cool, and I'm curious why it could not be allowed: Why can't we provide a private constrained subtype, of an inconstrained private type ?

package III is
   type A (<>) is private;
   subtype B is A;  -- should be a constrained subtype
private
   function Donne_String (N : Positive) return String;
   type A (N: Positive) is record
      II : Integer;
      Chaine : String(1..N) := Give_String(N);
   end record;
end III;

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

end of thread, other threads:[~2018-05-29 22:28 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-26 21:03 why "unconstrained subtype in component declaration" while said component given default value ? Mehdi Saada
2018-05-26 21:40 ` Jere
2018-05-26 22:11   ` Mehdi Saada
2018-05-26 23:55     ` Jere
2018-05-27  0:14       ` Jere
2018-05-27  0:29       ` Mehdi Saada
2018-05-27  0:45         ` Mehdi Saada
2018-05-27 17:15         ` Shark8
2018-05-27 17:30           ` AdaMagica
2018-05-27 18:17             ` Shark8
2018-05-29  1:28               ` AdaMagica
2018-05-29 17:20                 ` Mehdi Saada
2018-05-27  7:45   ` Jeffrey R. Carter
2018-05-26 23:41 ` Shark8
2018-05-27  7:07 ` Simon Wright
2018-05-27 17:22   ` Shark8
2018-05-27 12:24 ` Mehdi Saada
2018-05-29 22:28   ` Randy Brukardt

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