From mboxrd@z Thu Jan 1 00:00:00 1970
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
ip-172-31-65-14.ec2.internal
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!aioe.org!asLUhd0B7lqVMVZUsq4kzQ.user.46.165.242.75.POSTED!not-for-mail
From: Blady
Newsgroups: comp.lang.ada
Subject: Re: New aggregates with Ada 2022.
Date: Mon, 20 Jun 2022 21:36:49 +0200
Organization: Aioe.org NNTP Server
Message-ID:
References:
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="37742"; posting-host="asLUhd0B7lqVMVZUsq4kzQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.9.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
Xref: reader02.eternal-september.org comp.lang.ada:63997
List-Id:
Le 19/06/2022 à 16:15, Simon Wright a écrit :
> Blady writes:
>
>> aarm_202x_ch04.adb:491:40: error: container aggregate must use [], not ()
>
> If you look at ARM202x 4.3.5, you'll see that *container* aggregates
> must use []. I'm sure there wa a whole lot of argument about this in the
> ARG!
Yes I was aware of that but I wanted to give Empty_Map its real value of
the full type definition.
My understanding is:
you declare the aggregate aspect as:
type Map_Type is private
with Aggregate => (Empty => Empty_Map,
Add_Named => Add_To_Map);
thus:
MM : Map_Type;
...
MM := [] -- the compiler uses Empty_Map
MM := [1=>"toto", 4=>"titi"]; -- the compiler uses Add_To_Map
now if I declare:
Empty_Map : constant Map_Type := [];
then it could be an recursive infinite call, could be?
Note : in this latter case the compiler issues a ICE:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106031