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!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: A few questions Date: Thu, 19 Nov 2015 15:15:15 -0600 Organization: JSA Research & Innovation Message-ID: References: <5007b311-5d2e-448c-b8c8-fc2e2d88ea5e@googlegroups.com> <8hw612c7lfik.1cy0uanjjnpzv$.dlg@40tude.net> <1wew1bio4hygc.xotxd22aq47g.dlg@40tude.net> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1447967716 14511 24.196.82.226 (19 Nov 2015 21:15:16 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 19 Nov 2015 21:15:16 +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:28470 Date: 2015-11-19T15:15:15-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:1wew1bio4hygc.xotxd22aq47g.dlg@40tude.net... > On Wed, 18 Nov 2015 16:27:31 -0600, Randy Brukardt wrote: ... >> If you think allowing erroneous execution is somehow safe, you're in the >> wrong language forum. > > The point was that keeping the iteration state in the container is more > erroneous that keeping it outside in the iterator object. E.g. some > implementations store last found element, deploy caching and book-keeping > things in the container. That far less safe than keeping that stuff > outside > the container, e.g. in the iterator object. Sorry, missed your point originally. I don't think it's possible (in general) to keep the iteration information within the container, as that would mean that you could only do one iteration at a time. Which would be a nasty abstraction break (inner iterations on the same container would have to fail in that case, but for no good reason). That is, if the iterator info is part of the container, then for E of C loop for F of C loop ... end loop; end loop; cannot work. (The inner loop often occurs in some routine called from the body of the loop, it wouldn't be obvious like this is.) Randy.