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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,85361ba1ea5f711,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-22 08:22:19 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!uio.no!feed.news.tiscali.de!newsfeed.stueberl.de!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Lionel.DRAGHI@fr.thalesgroup.com Newsgroups: comp.lang.ada Subject: iterators as first class objects Date: Mon, 22 Dec 2003 17:19:22 +0100 Organization: Cuivre, Argent, Or Message-ID: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: melchior.cuivre.fr.eu.org 1072110014 42941 80.67.180.195 (22 Dec 2003 16:20:14 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Mon, 22 Dec 2003 16:20:14 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: X-Mailer: Internet Mail Service (5.5.2653.19) X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.3 Precedence: list List-Id: Gateway to the comp.lang.ada Usenet newsgroup List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:3699 Date: 2003-12-22T17:19:22+01:00 | -----Message d'origine----- | De: Robert I. Eachus ... | But the trick of having data structure packages return an | array view of | a collection, or actually an array of access values, is very, very | useful. I also really like this idiom, but there are drawbacks: 1 - you get more job done: First within the data structure component, you have to build the array. If the internal structure is not already an array, you will probably need an actual iterator. Then, within the user's code, there is the "for i in " loop. With an iterator, there is only one loop. 2 - within the component, the whole array is build: with an iterator, you may exit before the end. This is why we use it only for small data structure. As this leads to crystal-clear user's code, and as it's a common need, I think it's worth thinking about langage extension. -- Lionel Draghi