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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1042f393323e22da X-Google-Attributes: gid103376,public From: "John G. Volan" Subject: Re: Iterator Syntax [was: Re: STL in Ada95] Date: 1997/05/23 Message-ID: <338654BA.4D53@sprintmail.com>#1/1 X-Deja-AN: 243490118 References: <337813DF.598C@dynamite.com.au> <337D3AE4.28F7@dynamite.com.au> <337E5854.1366@sprintmail.com> <12871CEBFAB00ABE.93483F73373D0261.D1086334F6EF8ED8@library-proxy.airnews.net> <3380F4A5.1EBB@sprintmail.com> <33838C37.29C0@sprintmail.com> <33859890.5587@spam.innocon.com> Organization: Sprint Internet Passport Reply-To: johnvolan@sprintmail.com Newsgroups: comp.lang.ada Date: 1997-05-23T00:00:00+00:00 List-Id: Jeff Carter wrote: > > I'm curious. What is the advantage of "exposed" iterators like these > over encapsulated iterators for a structure: ... > The most typical usage, in my experience, has been to process every > Element in the Structure. Stopping before the end is rare; skipping some > at the beginning is even rarer. Processing every Element is easy for the > client with an encapsulated iterator (even easier if you leave the > Continue parameter out of Action). The exposed iterator requires the > client to set up Start and Stop and provide appropriate Advance and > Get_Item operations. True, but consider an application such as a text editor. You want to be able to scroll up and down through a container structure that's buffering the contents of a text file. A region of the text (between two iterators let's say) is currently visible in a window. Occasionally the region needs to be traversed to refresh the window, or it may need to be updated because an overlapping region has been modified in another window. At times, adjacent regions must be traversed to load them into the window (e.g., jump up/down by one screenful). Etc., etc., etc. Encapsulated iterators provide very restricted functionality, and for that functionality they are superb. But there are applications that require much more flexibility. ------------------------------------------------------------------------ Internet.Usenet.Put_Signature (Name => "John G. Volan", Home_Email => "johnvolan@sprintmail.com", Slogan => "Ada95: The World's *FIRST* International-Standard OOPL", Disclaimer => "These opinions were never defined, so using them " & "would be erroneous...or is that just nondeterministic now? :-) "); ------------------------------------------------------------------------