From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,d67ca8d922a33c8a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-03 06:44:22 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.icl.net!newsfeed.fjserv.net!news.algonet.se!algonet!news-stoc.telia.net!217.209.241.210.MISMATCH!news-stod.telia.net!telia.net!masternews.telia.net.!newsb.telia.net.POSTED!not-for-mail From: =?ISO-8859-1?Q?Bj=F6rn_Persson?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114 X-Accept-Language: sv, en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Heterogenous array References: <_U71c.51050$mU6.207186@newsb.telia.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Message-ID: <7bm1c.51092$mU6.207520@newsb.telia.net> Date: Wed, 03 Mar 2004 14:44:19 GMT NNTP-Posting-Host: 217.209.116.179 X-Complaints-To: abuse@telia.com X-Trace: newsb.telia.net 1078325059 217.209.116.179 (Wed, 03 Mar 2004 15:44:19 CET) NNTP-Posting-Date: Wed, 03 Mar 2004 15:44:19 CET Organization: Telia Internet Xref: archiver1.google.com comp.lang.ada:6029 Date: 2004-03-03T14:44:19+00:00 List-Id: Jean-Pierre Rosen wrote: > "Bj=F6rn Persson" a =E9crit dans le message de = news:_U71c.51050$mU6.207186@newsb.telia.net... >=20 >>Okay, after some experimentation I understand the difference, but I >>can't help thinking that it seems somewhat unlike Ada to say "make the >>discriminant immutable in all objects of this type" by not giving it a >>default value. Putting a "constant" somewhere would have been more >>intuitive. >=20 > Acutally, it's the other way round. >=20 > What you want to do is to be able to declare an unconstrained variable,= i.e.: > V : Parameter_Definition; >=20 > Since there is no discriminant constraint, the variable is not constrai= ned to always have the same value of the discriminant. > However, a discriminant is used by the compiler to make address computa= tions. It would be extremely dangerous to have an > uninitialized discriminant. Therefore, a declaration that does not spec= ify discriminants is allowed only if there are default values > for the discriminants. That's perfectly reasonable, but now consider this declaration: V : Parameter_Definition :=3D (Str, To_Bounded_String("A"), To_Unbounded_String("x"); Here the discriminant is initialized, so with your reasoning it=20 shouldn't matter whether there was a default value or not. Now let's try = to assign another value to the variable: V :=3D (Int, To_Bounded_String("B"), 1, 5, 2); This assignment works if there was a default value for the discriminant. = Otherwise it fails because the discriminant was locked to Str. There=20 would be no reason for this if the sole purpose were to avoid=20 uninitialized discriminants. --=20 Bj=F6rn Persson jor ers @sv ge. b n_p son eri nu