comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Why in (array) aggregate, no more component allowed after a dynamic choice ?
Date: Mon, 22 Jan 2018 18:57:47 -0600
Date: 2018-01-22T18:57:47-06:00	[thread overview]
Message-ID: <p461ab$3fd$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: aa4f3429-4bfd-44ac-a817-9fd0dd187841@googlegroups.com

It's complicated both for the reader and the compiler to ensure that an 
aggregate with multiple dynamic components in fact covers all of the 
components of the target type. (And that check is a hallmark of Ada, one 
cannot accidentally forget to specify a component and still have a working 
program.) It also gets very complicated to generate an others clause if a 
number of components at unknown locations are previously initialized.

Ada probably could have allowed two such components or maybe even three 
without the complexity growing too much. But there is a standard language 
design axiom that one should allow either zero, one, or unlimited/many of 
any thing. Allowing more than one dynamic component would violate this 
axiom, and the limit it is rarely encountered (you seem to have a knack for 
running into language corner-cases :-).

                                Randy.

"Mehdi Saada" <00120260a@gmail.com> wrote in message 
news:aa4f3429-4bfd-44ac-a817-9fd0dd187841@googlegroups.com...
>I had to write
> declare
>   Temp: T_Polynome (Poly_B.Degre + Ind -1);
> begin
>   Temp.Coef(Poly_B.Degre + Ind -1) :=
>   Poly_A.Coef(Poly_B.Degre+Ind)/Poly_B.Coef(Poly_B.Degre);
> end;
>
> Ind being a loop indice.
>
> whereas I would have prefered:
> Temp: T_polynome :=  (Poly_B.Degre + Ind - 1,(Poly_B.Degre + Ind - 1 => 
> Poly_A.Coef (Poly_B.Degre+Ind)/Poly_B.Coef(Poly_B.Degre), others => <>));
>
> What's the reason behind this limitation, whereas in one more sentence, 
> the same effect is achieved ? 


      reply	other threads:[~2018-01-23  0:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-20 10:55 "too few element" in an unconstrained array, given as litteral ? Mehdi Saada
2018-01-20 12:28 ` Niklas Holsti
2018-01-20 13:21   ` Mehdi Saada
2018-01-20 16:15     ` Niklas Holsti
2018-01-20 16:52       ` Mehdi Saada
2018-01-20 21:27         ` Niklas Holsti
2018-01-20 17:48 ` Why in (array) aggregate, no more component allowed after a dynamic choice ? Mehdi Saada
2018-01-23  0:57   ` Randy Brukardt [this message]
replies disabled

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