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,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!gXCTzWgngy6wN83KUtm4Jg.user.46.165.242.75.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: New aggregates with Ada 2022. Date: Mon, 20 Jun 2022 23:01:41 +0100 Organization: Aioe.org NNTP Server Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: gioia.aioe.org; logging-data="16086"; posting-host="gXCTzWgngy6wN83KUtm4Jg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:IjaUeySJSFVcuLO12efawRDRa+g= Xref: reader02.eternal-september.org comp.lang.ada:64001 List-Id: Blady writes: > 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? I think you'd need to supply the contents - Empty_Map here is presumably the full declaration (it is in your PR). Fixing this, the compiler is still confused (it thinks that 'others' in [others => [others => ' ']] isn't static - also if replaced by '1 .. 10'!!!).