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!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: A few questions Date: Sat, 14 Nov 2015 12:37:33 +0000 Organization: A noiseless patient Spider Message-ID: References: <1dolqizyi8gxi.t3173bhifuu1.dlg@40tude.net> <1705bpj6jrld0.1lc44o5yo6bj7$.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="29a2b57997615acde1fccc73c72adb9b"; logging-data="30378"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190I+jicJXPm+VMU5EyvaUpiCLf+PiFC2c=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:YYPslsZubQpn2SGUiRX0F79AQ0M= sha1:qHWJM6VQWuTwRqPXp4RmbGvH18w= Xref: news.eternal-september.org comp.lang.ada:28364 Date: 2015-11-14T12:37:33+00:00 List-Id: "Randy Brukardt" writes: > You'd probably keep some state in the iterator object (some access to > the file, at a minimum, possibly a buffer). The "cursor" would be the > character. Each call to Next would put the following character into > the "cursor". Easy-peasy. :-) It's a pity that Next takes the iterator object as an 'in' parameter. This means that, in general, the cursor needs to hold the state. It certainly needs some way of indicating end-of-iteration; perhaps a sentinel value. Can I use the same iterator more than once? (so long as the container hasn't changed, of course - I expect that would count as tampering, though) If so, that'd explain why Next.Object is an in parameter!