Path: news.daimi.aau.dk!news.uni-c.dk!newsfeed.sunet.se!news00.sunet.se!sunic!news.sprintlink.net!newsfeed.internetmci.com!delmarva.com!udel!usenet From: carroll@auriga.cis.udel.edu (Mark C. Chu-Carroll) Newsgroups: comp.lang.beta Subject: Re: Templates Date: 19 Oct 1995 15:14:12 GMT Organization: University of Delaware Lines: 41 Message-ID: References: NNTP-Posting-Host: auriga.cis.udel.edu In-reply-to: kolbjorn.aambo@ub.uio.no's message of 16 Oct 1995 11:18:53 GMT >>>>> "Kolbjørn" == Kolbjørn Aambø writes: In article kolbjorn.aambo@ub.uio.no (Kolbjørn Aambø) writes: Kolbjørn> C++'s tool for creating tempates seems like a powerful tool Kolbjørn> to generate better libraries. Does it? I disagree. A template specifies an *untyped parameterized textual replacement* which can be instantiated to generate real code. It's a *nasty* mechanism. There's a number of problems with it. For details, ask anyone who's tried using template code - most of us who've gone through that agony have horror stories. The central problem is the fact that it's an untyped mechanism in a strongly typed language - you end up getting some incomprehensible type errors as a result of template instantiations that generate type incorrect code. (What's particularly frustrating about that is the fact that it's actually pretty easy to generate parameterized types and functions in a strongly typed language. Just take a look at parameterized types and functors in ML, generics in Ada, constrained parametric types in Eiffel and Sather, parametric modules in Modula-3, or parameterized clusters in CLU. They've all solved that problem.) Beta already has the ability to build various kinds of parametrics, by using virtual patterns and pattern variables. And it's type safe and sane. The way that you go about building the parametrics is rather different, but then you do a *lot* of things differently in Beta. It works well, and it fits quite elegantly into the language. -- || Mark Craig Chu-Carroll: ||"We the people are getting tired of your lies || CIS Grad, Univ of Delaware || We the people now believe that it's time || PGP key available by finger || We're demanding our rights to the answers || carroll@cis.udel.edu || We elect a precedent to state of mind"-Fish