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 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.albasani.net!reality.xs3.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Generalized Iterators Date: Tue, 29 Dec 2015 16:12:59 -0600 Organization: JSA Research & Innovation Message-ID: References: NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1451427180 7098 24.196.82.226 (29 Dec 2015 22:13:00 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 29 Dec 2015 22:13:00 +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.6157 Xref: news.eternal-september.org comp.lang.ada:28931 Date: 2015-12-29T16:12:59-06:00 List-Id: "AdaMagica" wrote in message news:aea9159f-c02c-4a08-915a-504227424bd9@googlegroups.com... > I'm experiencing problems with generalized iterators. The code below is > reduced > to the minimum in order to be compilable and show the problem. Note that > the > body of Circularly_Linked_Lists is not given since not needed to produce > the > problem. > > The code follows strictly the examples given in the Ada 2012 Rationale. > Expecially the function Iterate is defined thus: > > function Iterate (CLL: not null access Circularly_Linked_List) > return Forward_Iterator'Class; > > This produces the compiler message (GNAT GPL 2015) > > for Cursor in List.Iterate loop > ausprobieren.adb:15:21: expect object that implements iterator interface > ... I get the same result with the compiler I have. (It's probably newer than GPL 2015, but I'm not certain as it is a wavefront for a problem last year.) ... > I can understand this since Iterate has the list as an access parameter, > and the compiler tries to construct the "in" loop from the default > iterator. > But also this does not work: > > for Int of List'Access loop > > Is this a problem of GNAT or is there anything I just don't see? Looks like a problem of GNAT. Didn't we discuss something like this example within the last few months here?? Randy.