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: Re: STL, Ada, C++ (Was Re: The Next Microsoft?) Date: 2000/05/08 Message-ID: #1/1 X-Deja-AN: 620864093 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> <8f50hc$hpo$1@nnrp1.deja.com> Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: nntp1.ba.best.com 957825938 220 bpr@206.184.139.136 MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-05-08T00:00:00+00:00 List-Id: On 8 May 2000, Hyman Rosen wrote: > Robert Dewar writes: > > I am not at all convinced that automatic instantiation is > > a help to the reader and maintainer, on the contrary, it > > seems very awkward to have uses of templates not be visible > > from this point of view. > > I consider automatic instantiation of templates to be the compile-time > polymorphism equivalent of run-time dispatching on class-wide types. Correct, and type theorists refer to this as "parametric polymorphism". Ada doesn't really have parametric polymorphism, it's generics are really monomorphic. > When you make a dispatching call, you do not know what function you > are calling. Similarly, you should be able to call a generic function > without explicitly stating which one you are calling. This is one good way to look at it, since dispatching is sometimes a negative with respect to readability and maintainability. It is also similar to overloading; if you have several overloaded functions in scope you don't explicitly say which you are calling in Ada or C++. In languages without overloading you have to use qualified names. As much as I like Ada, this is one thing I really prefer about the C++ design. This discussion might be more interesting with specific examples, so I'll put some together in an Ada-like language with automatic instantiation. Shen and Cormack's paper from Tri-Ada 91 is a good place to start for anyone interested. -- Brian