Article View: comp.std.c++
Article #755Re: The concept of templates considered ill designed
From: David (Lujun) Shang
Date: Tue, 06 Oct 1992 01:19
Date: Tue, 06 Oct 1992 01:19
38 lines
2187 bytes
2187 bytes
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
Technical Details
Message-ID:
<1992Oct6.011951.10984@cadsun.corp.mot.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!panther!mothost!motsrd!newsReferences:
<23808@alice.att.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++,comp.lang.c++ Path: arc1-ca.pugleaf.net!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