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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,897417b380f5731e X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: STL, Ada, C++ (Was Re: The Next Microsoft?) Date: 2000/05/07 Message-ID: #1/1 X-Deja-AN: 620453337 References: <8eg37k$15n$1@nnrp1.deja.com> <8epkoa$b8b$1@nnrp1.deja.com> <8eu0ob$7qv$1@nnrp1.deja.com> <391328F0.1221@synquiry.com> <39133213.64A@Ganymede.com> Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: nntp1.ba.best.com 957742640 224 bpr@206.184.139.136 MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-05-07T00:00:00+00:00 List-Id: On Fri, 5 May 2000, Bill Greene wrote: > Hyman Rosen wrote: > > > > ... > > Ada has nothing like it [STL], since it is missing automatic instantiation > > of generics. > > Ada must have something like it, since Stepanov ported STL from Ada to > C++. There are Ada versions of STL-like libraries, where "-like" means that the libraries are based on active iterators defined over sequential containers with algorithms parameterized in terms of those iterators, and hence independent of the particular type of container. It happens that operations of C pointer arithmetic and random access map well to the traversal of sequential data structures and so you get a nice syntactic dovetailing in the C++ STL with this part of generic programming. Clearly non-sequential collections can't be handled this way. I don't think Ada's functional syntax for ++, --, etc is a fundamental problem. I agree that the lack of automatic instantiation is a weakness of Ada generics vis-a-vis C++ templates. There are other places where that facility would come in handy besides STL style generic programming. I don't think their absence is fundamental, but I suppose that is debatable. Ada has subprogram nesting and allows you to instantiate generics with local functions and overloading on return type. So generic programming is different in Ada, less powerful in some ways, due to the lack of automatic instantiation, more powerful in others. I think that the STL is well designed, and has certainly influenced the design of C++ in a good way. If anything, I wish templates and the STL had been in the language earlier, and the OO part had come later. -- Brian