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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.129.74.2 with SMTP id x2mr759173ywa.26.1504747747023; Wed, 06 Sep 2017 18:29:07 -0700 (PDT) X-Received: by 10.36.250.140 with SMTP id v134mr119967ith.0.1504747746903; Wed, 06 Sep 2017 18:29:06 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!q8no405302qtb.0!news-out.google.com!c139ni848itb.0!nntp.google.com!o200no55870itg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 6 Sep 2017 18:29:06 -0700 (PDT) In-Reply-To: <9677f15f-c612-4ac4-9c2d-64fbf530873e@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.218.37.33; posting-account=W2gdXQoAAADxIuhBWhPFjUps3wUp4RhQ NNTP-Posting-Host: 76.218.37.33 References: <693d41af-1da7-4c47-825a-198a082aaf9a@googlegroups.com> <9677f15f-c612-4ac4-9c2d-64fbf530873e@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Why does Ada.Iterator_Interfaces specify Next as a function rather than a procedure? From: Stephen Leake Injection-Date: Thu, 07 Sep 2017 01:29:06 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Body-CRC: 3747536439 X-Received-Bytes: 2706 Xref: news.eternal-september.org comp.lang.ada:47961 Date: 2017-09-06T18:29:06-07:00 List-Id: On Wednesday, September 6, 2017 at 8:04:15 PM UTC-5, Stephen Leake wrote: > > type State is record > > -- The components of the state. > > end record; > > > > type My_Iterator is new Ada.Finalization.Controlled and > > Reversible_Iterator with record > > My_State : access State; -- Writable state. > > The_State : aliased State; > > end record; I don't see how to do this; 'Reversible_Iterator' is defined in an instantiation of Ada.Iterator_Interfaces, which takes the type My_Iterator as a generic parameter. Just leaving that off still fails, if I try to make the contents of the cursor private while exposing the Iterate function. Are you relying on some new Ada 202x syntax here? > > > > procedure Initialize (Obj : in out My_Iterator) is > > begin > > Obj.My_State := The_State'Access; -- (*) > > end Initialize; > > > This is a legitimate technique -- it is NOT erroneous in Ada > > 2012 -- so if your compiler has problems with it, file a bug report and if > > they don't believe that, send me a proposed ACATS test! > > You are implying that my worry about the compiler assuming the input and output of Next must point to different items is not valid. > > I'll give it a try. > > -- Stephe