comp.lang.ada
 help / color / mirror / Atom feed
From: Jere <jhb.chat@gmail.com>
Subject: Re: why "unconstrained subtype in component declaration" while said component given default value ?
Date: Sat, 26 May 2018 17:14:04 -0700 (PDT)
Date: 2018-05-26T17:14:04-07:00	[thread overview]
Message-ID: <150845df-3aae-4297-86a4-73fe234d84f1@googlegroups.com> (raw)
In-Reply-To: <067fdb8b-e69c-4ec7-b7ae-50a11dc97d83@googlegroups.com>

On Saturday, May 26, 2018 at 7:55:36 PM UTC-4, Jere wrote:
> On Saturday, May 26, 2018 at 6:11:13 PM UTC-4, Mehdi Saada wrote:
> > But isn't the situation the same in automatic variables, with arrays whose constraint is only known at run time ? Like this:
> > procedure Main is
> >    subtype Pos_Little is Positive range 1..56;
> >    package Num_Gen is new Ada.Numerics.Discrete_Random (Pos_Little);
> >    Gen : Num_Gen.Generator;
> > begin
> >    declare
> >       Arr : array (1..Num_Gen.Random(Gen)) of Positive;
> >    begin
> >       null;
> >    end;
> > end Main;
> > Yet this case is legal.
> 
> Record types need to support Representation Clauses, where as normal 
> variables do not.

Actually, since you can do the one Shark8 showed at runtime as well, I 
am not sure of the "why" anymore.  I'll have to think on it or perhaps
someone else will chime in.

  reply	other threads:[~2018-05-27  0:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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
replies disabled

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