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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!feeder3.cambrium.nl!feed.tweaknews.nl!212.27.60.9.MISMATCH!proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Generic Package Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH 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> <1177944533.13970.17.camel@localhost> <2aq08qbvw0ym$.1rquampzo7o53.dlg@40tude.net> Date: Mon, 30 Apr 2007 22:04:00 +0200 Message-ID: <1ieq3io2d6nnq$.13818v3y35gnr.dlg@40tude.net> NNTP-Posting-Date: 30 Apr 2007 22:03:38 CEST NNTP-Posting-Host: e46ec04a.newsspool3.arcor-online.net X-Trace: DXC=Q\Nj@NjH3O[\PS5Xo=M[RVMcF=Q^Z^V3X4Fo<]lROoRQFl8W>\BH3YRKYQ2DP^03kZDNcfSJ;bb[UIRnRBaCd\J?k9gT\f65V X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:15430 Date: 2007-04-30T22:03:38+02:00 List-Id: On Mon, 30 Apr 2007 20:29:22 +0100, Simon Wright wrote: > "Dmitry A. Kazakov" writes: > >> On Mon, 30 Apr 2007 16:48:53 +0200, Georg Bauhaus wrote: > >>> "The foreach procedure operates as if the following body >>> were written >>> >>> procedure foreach(S: Set) is >>> C: Cursor; >>> begin >>> C := first(S); >> >> You forgot that first is not defined on Set, which is not >> well-ordered and thus does not have visible implementations of >> first, last, next, prev etc in its interface. It has Length, =, /=, >>:=, and, or, xor, /, Empty, in, not in. [*] > > First is not *publicly* defined on Set but this is *implementation*, > for Pete's sake! It's likely to be hard to implement iteration/foreach > efficiently without private knowledge You missed the point. It was that if foreach were a primitive operation defined on an unordered set, then its contract could not be stated. The example I posed before Georg was to prove that counting members using foreach with an atomic integer would indeed have returned the number of members. (that is - without looking into the implementation, because there it is obviously ordered, iteratable, whatever) > .. but you could, for example, > copy the Set and then pick a random member, remove it from the copy, > and process it, until the copy was empty. I answered to this in a subthread. To be able to pick a random member <=> to have an order. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de