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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fa18fb47ddd229a7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-21 05:52:19 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!dialin-145-254-037-037.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Proposed change to BC iterator parameters Date: Sun, 21 Dec 2003 14:58:35 +0100 Organization: At home Message-ID: References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-037-037.arcor-ip.net (145.254.37.37) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de 1072014738 9905610 145.254.37.37 ([77047]) User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.lang.ada:3667 Date: 2003-12-21T14:58:35+01:00 List-Id: Robert I. Eachus wrote: > Currently I often provide tools in my data structures packages to > provide everything viewed as an array. This allows me to do what Bob > wants, but it would be really nice to extend the language so that > iterators are first class objects known to the language so that the > above pseudo code (for E in ...) would be supported if the > Some_Structure package provided an iterator. You should also be able to > say > > if E in My_Structures.Some_Iterator then ... > > (This would require another signature in the template for iterators to > make it efficient.) > > Do I think this will make it into Ada 0Y? No. Ada 1Z? Possibly. > > 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. (Notice that the difference between such an iterator and normal > iterators is that it provides a snapshot. Changes to the actual data > structure while iterating through the array won't be visible in the > loop. Often this is what you want. Sometimes it isn't, then it gets > painful...) But if interfaces are being added to Ada, why not to allow abstract array interface? Then just make My_Structure an implementation of the abstract array and here you are! -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de