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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.33.134 with SMTP id r6mr29955892obi.7.1448637958221; Fri, 27 Nov 2015 07:25:58 -0800 (PST) X-Received: by 10.182.87.132 with SMTP id ay4mr547341obb.14.1448637958195; Fri, 27 Nov 2015 07:25:58 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!mv3no4046705igc.0!news-out.google.com!f6ni14106igq.0!nntp.google.com!mv3no4046694igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 27 Nov 2015 07:25:57 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=153.181.129.1; posting-account=Mi71UQoAAACnFhXo1NVxPlurinchtkIj NNTP-Posting-Host: 153.181.129.1 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0c524381-442a-49cc-9d72-27a654320153@googlegroups.com> Subject: Two approaches of iterators for the key-value pairs From: ytomino Injection-Date: Fri, 27 Nov 2015 15:25:58 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:28559 Date: 2015-11-27T07:25:57-08:00 List-Id: Hello, I'm reading AI12-0009-1 "Iterators for Directories and Environment_Variables". http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0009-1.txt?rev=1.4 And there is interesting difference between the new iterator of Ada.Environment_Variables and the existing iterators. (The boolean trick of these new iterators is also interesting, but set aside.) A loop for Ada.Environment_Variables would be like below, according to this AI: for E *of* Ada.Environment_Variables.All_Variables loop -- E is Iterator_Element (Name_Value_Pair_Type) Name (E) -- key Value (E) -- value end loop; On the other hand, as we already know, a loop for Ada.Containers.Hashed_Maps/Ordered_Maps: for I *in* The_Map_Object.Iterate loop -- I is Cursor Key (E) -- key Element (E), Reference (E).Element.all -- value end loop; If you create new iterator for some key-value pairs, which approach do you like? -- Yuta Tomino