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,FREEMAIL_FROM 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!news2.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!news.highwinds-media.com!xara.net!gxn.net!194.159.246.34.MISMATCH!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Generic Package Date: Mon, 30 Apr 2007 20:29:22 +0100 Organization: Pushface Message-ID: 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> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1177961362 763 62.49.19.209 (30 Apr 2007 19:29:22 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Mon, 30 Apr 2007 19:29:22 +0000 (UTC) Cancel-Lock: sha1:pZyhMg5XvvU76OIB1aVOlkMLXaA= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (darwin) Xref: g2news1.google.com comp.lang.ada:15429 Date: 2007-04-30T20:29:22+01:00 List-Id: "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 .. 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.