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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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.11.199 with SMTP id s7mr44753338pbb.5.1317370188218; Fri, 30 Sep 2011 01:09:48 -0700 (PDT) Path: lh7ni8140pbb.0!nntp.google.com!news1.google.com!news3.google.com!feeder.news-service.com!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: discriminant questions Date: Fri, 30 Sep 2011 10:10:13 +0200 Organization: cbb software GmbH Message-ID: <1sa9q0z4ewznh.boyk8pxq29w6.dlg@40tude.net> 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> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news1.google.com comp.lang.ada:18223 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2011-09-30T10:10:13+02:00 List-Id: On Thu, 29 Sep 2011 20:24:23 -0500, Randy Brukardt wrote: > "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 That rather is for Element of Set loop (Indicator set is a set of things indicating elements of another set, e.g. a set of indices, like range, singleton etc.) > -- 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. Which is potentially a problem, because for native arrays you can get the related types directly from the array. There is a cloud of types around the container type. The interface of an abstract container should include operations/aspects/attributes to get at these types (like T'Class gets class T from T). E.g. for Index in Container'Range loop -- Indicator set for Element in Container loop -- The set itself > 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.) Maybe, however other issues are the behavior under inheritance: from the container type, from the index type, from the type of the sets of indices (absent). How these types can be constrained to subtypes. Objects of index sets (ranges, singletons, diagonals etc). Subsets of the container sets (slices). All these types and subtypes coherently passed to a generics. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de