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=-0.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FREEMAIL_REPLY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3957a46660bc0588 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-13 12:41:27 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed1.uni2.dk!news.get2net.dk.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada Subject: Re: strings and multidimensional arrays References: <3F88D320.80706@chartermi.net> <3F88E586.5060809@chartermi.net> <3F89621F.7070406@comcast.net> <3F89EB77.3030007@comcast.net> <3F8ADB3D.5010000@comcast.net> From: Mark Lorenzen Message-ID: User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux) Cancel-Lock: sha1:9gAJvs0e0UQ9c7yUTJspu8yhZHg= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 13 Oct 2003 23:47:52 +0200 NNTP-Posting-Host: 62.84.221.216 X-Complaints-To: abuse@colt-telecom.dk X-Trace: news.get2net.dk 1066074087 62.84.221.216 (Mon, 13 Oct 2003 21:41:27 CEST) NNTP-Posting-Date: Mon, 13 Oct 2003 21:41:27 CEST Organization: Colt Telecom Kunde Xref: archiver1.google.com comp.lang.ada:787 Date: 2003-10-13T23:47:52+02:00 List-Id: "Martin Dowie" writes: > "Robert I. Eachus" wrote in message > news:3F8ADB3D.5010000@comcast.net... >> type Unconstrained_Record (D : Disc := One) is record > > Isn't this the key line here? The default ("One") allows you to change it > late (as often Yes it is. If a record contains a variant_part and the discriminant governing the variant_part has a default value, then it is allowed to perform an assignment that changes the value of the discriminant and therefore also the variant_part. So the following is allowed: procedure Option is type Optional_Integer (Defined : Boolean := False) is record case (Defined) is when True => Value : Integer; when False => null; end case; end record; Integer_Value : Optional_Integer; begin Integer_Value := Optional_Integer'(Defined => True, Value => 5); Integer_Value := Optional_Integer'(Defined => True, Value => 3); Integer_Value := Optional_Integer'(Defined => False); end Option; > as you like). If you didn't have this, then you would have to provide a > value at > declaration and it would be 'fixed' for the life of the object. Also correct. The following is *not* legal: procedure Option is type Optional_Integer (Defined : Boolean) is record case (Defined) is when True => Value : Integer; when False => null; end case; end record; Integer_Value : Optional_Integer (Defined => True); begin Integer_Value := Optional_Integer'(Defined => True, Value => 5); Integer_Value := Optional_Integer'(Defined => True, Value => 3); Integer_Value := Optional_Integer'(Defined => False); end Option; The last assignment will raise Constraint_Error. I can't find the paragraph(s) in the ARM, but it is burried there somewhere. - Mark Lorenzen