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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Array of records with default values not propagating to array Date: Sun, 4 Feb 2018 11:21:36 +0200 Organization: Tidorum Ltd Message-ID: References: <19b28472-5810-4306-b1b1-545cc7b6edcc@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net LR9ftJczlJ0PuidG/Npn2AexWqv+OwAosxc780zcM9zbIgrzPs Cancel-Lock: sha1:9rxfMIZeIyGZmh3jSPGhQkUmEUA= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: Xref: reader02.eternal-september.org comp.lang.ada:50296 Date: 2018-02-04T11:21:36+02:00 List-Id: On 18-02-03 17:26 , Simon Wright wrote: > I find that > > type Card_Info (Trump : Boolean := False) is record > Name : Ada.Strings.Unbounded.Unbounded_String; > Divinatory_Meaning : Ada.Strings.Unbounded.Unbounded_String; > ... > > TDeck (Index) := > (Trump => True, > Trump_Value => Index_1, > others => <>); > ... > > TDeck (Index) := > (Trump => False, > Card_Value => Card_Index, > Suit_Value => Suit_Index, > others => <>); > > compiles OK and seems to run perfectly well. Presumably this is OK > because the initial value for an otherwise-uninitialized unbounded > string is the empty string. Or maybe it's GNAT being over-helpful, since > it seems not to obey ARM 4.3.1(17.1)[1]. > > [1] http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-4-3-1.html#p17.1 I don't think that ARM paragraph applies to the "others" in this code. The paragraph says: "A record_component_association for a discriminant without a default_expression shall have an expression rather than <>" but the components covered by the "others" in this code are not discriminants. The discriminant is the Trump component, and the associations for Trump have an expression (True or False), not <>. (Moreover, the Trump component has a default expression (False), which makes ARM 4.3.1(17.1) inapplicable even to "Trump => <>".) -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .