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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,70414f56d810c10c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.8.229 with SMTP id u5mr43503651pba.0.1317345867177; Thu, 29 Sep 2011 18:24:27 -0700 (PDT) MIME-Version: 1.0 Path: lh7ni7916pbb.0!nntp.google.com!news1.google.com!news3.google.com!feeder.news-service.com!aioe.org!news.tornevall.net!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: discriminant questions Date: Thu, 29 Sep 2011 20:24:23 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <9f37b726-d80b-4d24-bf3f-28a14255f7fd@s20g2000yql.googlegroups.com> <1tpl2pc36ptr4$.txv4v3wmkjlm.dlg@40tude.net> <1malv6h6q31j3.uz9ws5j0glnm.dlg@40tude.net> <4e81a2f4$0$7624$9b4e6d93@newsspool1.arcor-online.net> <4e81e788$0$6542$9b4e6d93@newsspool4.arcor-online.net> <4e8210ab$0$6550$9b4e6d93@newsspool4.arcor-online.net> <4e83b568$0$7620$9b4e6d93@newsspool1.arcor-online.net> <1vb9afcggqs8b$.prrlzbnf51p$.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1317345866 31611 69.95.181.76 (30 Sep 2011 01:24:26 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 30 Sep 2011 01:24:26 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 Xref: news1.google.com comp.lang.ada:18212 Date: 2011-09-29T20:24:23-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:1vb9afcggqs8b$.prrlzbnf51p$.dlg@40tude.net... > On Thu, 29 Sep 2011 02:01:44 +0200, Georg Bauhaus wrote: ... >> I'm not sure I understand. > > A for-loop consists of its body and its "header". In Ada you can define > the > body of such loop as whatever pleases you. But the loop header Ada fails > to > abstract it properly, e.g. as: > > for Index in Indicator-Set loop Huh? That's exactly what Ada 2012 allows you to do - redefine the meaning of the loop header. And you get two forms: for Index in Indicator_Set loop -- Index is a cursor (or whatever index type you like) for Element of Indicator_Set loop -- Element represents each of the elements of the set, no index needed (or provided). Element can be a variable in some circumstances, so this form can be used to update the set without any viisible use of indexes (cursors). Someone of course has to define the "iterator type" and "iterator object" which provides that, and those can do anything that fits into the pattern. (One possibility that was discussed was iterating a construct-on-use data structure.) This is a powerful new abstraction for Ada, making it much easier to treat a container in the same way as a primitive array type. (Array types also get the new element syntax so there consistency with that.) Randy.