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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,229ea0001655d6a2 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!out01a.usenetserver.com!news.usenetserver.com!in01.usenetserver.com!news.usenetserver.com!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsinpeer00.lnd.ops.eu.uu.net!bnewsinpeer00.bru.ops.eu.uu.net!emea.uu.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Generic Package From: Georg Bauhaus In-Reply-To: References: <1177539306.952515.222940@s33g2000prh.googlegroups.com> <1177601484.444701.171560@r35g2000prh.googlegroups.com> <9eejm6rqip.fsf@hod.lan.m-e-leypold.de> <19qllkvm6ut42$.1iqo74vjgmsrv$.dlg@40tude.net> <1177801611.10171.32.camel@localhost.localdomain> <1woad6hn9idy2$.6otnwphc1o0h$.dlg@40tude.net> <1177929029.6111.34.camel@localhost> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-ID: <1177944533.13970.17.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Date: Mon, 30 Apr 2007 16:48:53 +0200 Organization: Arcor NNTP-Posting-Date: 30 Apr 2007 16:43:11 CEST NNTP-Posting-Host: f87f9dcd.newsspool4.arcor-online.net X-Trace: DXC=fSMcLc_LAPefF8a^:6>b7e4IUK On Mon, 2007-04-30 at 14:16 +0200, Dmitry A. Kazakov wrote: > > So it is not a question of trusting the iterator but rather > > a mere consequence of trust in the iterator being defined > > as required by the specification of iterator. > > But you could not present any formal specification of. > > Consider the program that counts elements of a set: > > C : Protected_Integer; > procedure Count is > begin > C.Inc; > end Count; > begin > C.Set (0); > foreach S do Count; "The following iterator is defined: generic with procedure P(C: Cursor); procedure foreach(S: Set); "The foreach procedure operates as if the following body were written procedure foreach(S: Set) is C: Cursor; begin C := first(S); while has_element(C) loop P(C); next(C); end loop; end; "The set S is locked while foreach is executing." > How could you prove that C.Get = S'Length? Given Sum: Integer := 0; procedure Count(C: Cursor) is begin Sum := Sum + 1; end; procedure how_many is new foreach(P => Count); Still impossible to show the above after the first run? > >>> Is there iteration in the following SETL expression? > >>> > >>> Result := { x : x in {1, 3, 24, 17, 11} | P(x) }; > >> > >> Iteration in what? In the language construct? In Result? Consider a > >> possibility that Result were computed at compile time. Would it still be > >> iteration? > > > > That's the point, there is iteration in this set former, but it > > happens behind the scene: on an AS-IF basis, it does not even matter > > when (or even if) iteration is happening; > > Right, that is _the_ point. What is the reason to call this "iteration," > rather than an operation constructing a new set? (It isn't called iteration, actually. The above is a set former. This was meant to be used for clarification, i.e. to learn what iteration might mean.)