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-30 05:31:30 PST Path: archiver1.google.com!news2.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!snoopy.risq.qc.ca!newsfeed.news2me.com!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: Tue, 30 Sep 2003 12:31:28 GMT NNTP-Posting-Host: 65.110.133.134 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.atl.earthlink.net 1064925088 65.110.133.134 (Tue, 30 Sep 2003 05:31:28 PDT) NNTP-Posting-Date: Tue, 30 Sep 2003 05:31:28 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:6 Date: 2003-09-30T12:31:28+00:00 List-Id: Michael Erdmann writes: > I assume, that the procedure Generic_Algorithm is containing some kind > of implementation of an iterator based on the input parameters of the > generic? Well, technically the iterator itself is implemented elsewhere. The generic algorithm doesn't care. It just uses the iterator, like this: procedure Generic_Algorithm (First, Back : IT) is I : IT := First; begin while I /= Back loop ... -- whatever Process (I); ... -- whatever I := Succ (I); end loop; end Generic_Algorithm; > You are right, this provides a standarized interface, but i guess the > procedure Generic_Algorithm contains some kind of implementation of an > iteration based on the methods specified in the input? The Generic_Algorithm contains some kind of implementation of an algorithm, not an iterator. The algorithm uses the iterator to implement the algorithm. >I think the is a different view on the topic by defining a >functionality of an interface, providing a generic implementation which >defines the interface for the programmer. Yes, the generic algorithm specifies what it requires of the iterator. Any iterator satisfying those (logical) properties can be used, as we saw in the example. > This was exactly what i dont like to do. I dont like to spent the >effort of breaking down a concept into a generic implementation. This >is the reason why i like to use interfaces. Well, that's not static polymorphism. It's dynamic polymorphism -- or at least it's type derivation. I much don't like inheritance, but you seem prefer it. Vive la difference, comme on dit en France (et aux Etats Unis, aussi).