From 774458185384466909
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,109af18a94b8a35c
X-Google-Attributes: gid109fba,public
X-Google-Thread: f78e5,e5cae9ffbf1dd57e
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-10-05 05:08:14 PST
Xref: sparky comp.lang.c++:14534 comp.std.c++:1311
Newsgroups: comp.lang.c++,comp.std.c++
Path: sparky!uunet!think.com!spool.mu.edu!umn.edu!csus.edu!borland.com!pete
From: pete@genghis.borland.com (Pete Becker)
Subject: Re: The concept of templates considered ill designed
Message-ID: <1992Oct5.160022.29224@genghis.borland.com>
Originator: pete@genghis.borland.com
Sender: news@borland.com (News Admin)
Organization: Borland International
References: <Ienr=wm00awU8A=Ecc@andrew.cmu.edu> <23801@alice.att.com> <0enxJ1W00awTMNepU8@andrew.cmu.edu>
Date: Mon, 5 Oct 1992 16:00:22 GMT
Lines: 42

In article <0enxJ1W00awTMNepU8@andrew.cmu.edu> osoelgaultier+@CMU.EDU (Stefan Monnier) writes:
>Excerpts from netnews.comp.lang.c++: 5-Oct-92 Re: The concept of
>template.. Andrew Koenig@alice.att. (287)
>
>> In article <Ienr=wm00awU8A=Ecc@andrew.cmu.edu> osoelgaultier+@CMU.EDU
>> (Stefan Monnier) writes:
>
>> > But the suggested 'templates with type constraint' would
>> > permit to change it into an implementation issue.
>
>> Really?  Why do you think so?
>> -- 
>> 				--Andrew Koenig
>> 				  ark@europa.att.com
>
>
>As are currently implemented templates, you don't know
>anything about the actual type at compile-time.
>So that no method calls or variable accesses can be compiled
>for any variable of 'template type'.
>
>The only thing you can do at compile-time with those variables
>is to store them and retrieve them in a structure, but, again, 
>without making them execute anything.
>
>A hashtable (which requires the type to have at least a
>'hash' method) couldn't be compiled, as the compiler 
>can know where the 'hash' method will be in the actual type !
>
>That's why Eiffel has those type constraints: it's not a feature,
>it's just necessary to be able to compile it separately ! (and to
>typecheck separately also)
>

	But this has very little to do with templates.  Constrained parameters
and no further knowledge of the actual type is equivalent, as far as I can see,
to simply carrying around a pointer to the actual class, and dealing with it
only through the known interface.  You don't need templates to implement this,
and I don't see that there's anything gained by using the template mechanism
to do it.
	Templates avoid the extra indirection that's needed when you don't
know what type you're dealing with.


