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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,309015504ed37ff0 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-29 15:56:54 PST Path: news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!not-for-mail Sender: mheaney@MHEANEYX200 Newsgroups: comp.lang.ada Subject: Re: Usage of Interfaces with Ada 95 References: <1064595326.831730@master.nyc.kbcfp.com> <4nii41-067.ln1@boavista.snafu.de> From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 29 Sep 2003 22:56:53 GMT NNTP-Posting-Host: 65.110.133.134 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.atl.earthlink.net 1064876213 65.110.133.134 (Mon, 29 Sep 2003 15:56:53 PDT) NNTP-Posting-Date: Mon, 29 Sep 2003 15:56:53 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: news1.google.com comp.lang.ada:229 Date: 2003-09-29T22:56:53+00:00 List-Id: Simon Wright writes: > The STL means something quite like "designator of one end of a > half-open range". > > I am not a C++ speaker, but > > for (i = cont.start(); i != cont.oneAfterTheEnd(); i++) > > is *not* the way the GoF, or Grady, describe it. I disagree that this is any different. Let's rewrite the generic algorithm that I posted earlier, to use Simon's preferred syntax: generic type IT is private; with function Succ (I : IT) return IT is <>; with procedure Process (I : IT) is <>; with function Is_Done (I : IT) return Boolean is <>; procedure Generic_Algorithm (First : in IT); Now let's use the a Charles list (say) to instantiate the Simon algorithm: procedure Op (List : in List_Subtype) is procedure Process (I : IT) is ...; function Is_Done (I : IT) return Boolean is begin return I /= Back (List); end; procedure Algorithm is new Generic_Algorithm (IT, Succ, Process, Is_Done); begin Algorithm (First (List)); end; It's equivalent to what I showed yesterday. There is no difference between "STL" iterator and "Booch" iterator, except for syntax. In fact you could easily convert Grady's active iterator implementation of p. 158 to use Stepanov syntax, by simply declaring a constant of type Iterator (equal to null internally) and providing an equality operator for Iterator. It's all the same.