From 5354363332706194587
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 18:10:48 PST
Xref: sparky comp.std.c++:1323 comp.lang.c++:14567
Newsgroups: comp.std.c++,comp.lang.c++
Path: sparky!uunet!panther!mothost!motsrd!news
From: shang@corp.mot.com (David (Lujun) Shang)
Subject: Re: The concept of templates considered ill designed
Message-ID: <1992Oct6.011951.10984@cadsun.corp.mot.com>
Sender: news@cadsun.corp.mot.com
Reply-To: shang@corp.mot.com
Organization: Motorola, Inc., Software Research and Development, Rolling Meadows, IL. 60008
References: <23808@alice.att.com>
Date: Tue, 6 Oct 92 01:19:51 GMT
Lines: 40

In article <23808@alice.att.com> ark@alice.att.com (Andrew Koenig) writes:
> In article <0enxJ1W00awTMNepU8@andrew.cmu.edu>, osoelgaultier+@CMU.EDU  
(Stefan Monnier) writes:
> 
> > 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'.
> 
> But you still haven't answered my question.
> 
> My question was: what reason do you have to believe that
> adding inheritance constraints would solve the problem?
> 
> In thinking about the answer, don't forget about inline functions.
> -- 
> 				--Andrew Koenig
> 				  ark@europa.att.com

Please note that a constrained parameterized class is a completely 
different language concept from C++ template, though it can replace the  
template concept anyway.

A constrained parameterized class is an abstract class. You need not to
"instantiate" it before using it. Compilers can generate real executable 
codes for member functions defned in a constrained parameteried class. 
Once a parameterized class is compiled separately, the compiler can 
ensure no type-error related to the usage of the class parameters. 
Therefore, there is no need to expose the source code to the user. What 
the user need to prove is that whether his/her actual parameter is 
conformable to the class parameter specification. For library-developers, 
since the code is already generated by the compiler and built into a 
library, it is no longer needed for them to ship the source code with 
their products.

Inline functions are an independent language issue.

David Shang




