Article View: comp.std.c++
Article #757Re: The concept of templates considered ill designed
From: Pete Becker
Date: Tue, 06 Oct 1992 17:41
Date: Tue, 06 Oct 1992 17:41
32 lines
2042 bytes
2042 bytes
In article <1992Oct6.020042.11130@cadsun.corp.mot.com> shang@corp.mot.com writes: >In article <1992Oct5.160022.29224@genghis.borland.com> pete@genghis.borland.com >(Pete Becker) writes: >> >> 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. > >Really? In my O-O design experience, it is very common to have a generic >model which is composed of several sub-models: > > M < SM1, SM2, SM3 > > >and then use the genric model to produce another generic model M': > > M' < SM1', SM2', SM3' > > >with more detailed specification. I seem to have not made myself clear. What I was responding to was the claim that constrained parameters ALLOW THE TEMPLATE DEFINITION TO BE COMPILED INDEPENDENTLY OF ANY PARTICULAR INSTANTIATION. While that's certainly true, it offers very little beyond what's currently available without using templates, precisely because the compiler knows nothing about the actual types of the template parameters. If you want constrained templates AND independent compilation of template definitions, you've already got it. But don't call it a template. Call it a forwarding class. -- Pete
Technical Details
Message-ID:
<1992Oct6.174129.10404@genghis.borland.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!gumby!wupost!decwrl!borland.com!peteReferences:
<1992Oct5.160022.29224@genghis.borland.com> <1992Oct6.020042.11130@cadsun.corp.mot.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++,comp.lang.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!gumby!wupost!decwrl!borland.com!pete From: pete@genghis.borland.com (Pete Becker) Subject: Re: The concept of templates considered ill designed Message-ID: <1992Oct6.174129.10404@genghis.borland.com> Originator: pete@genghis.borland.com Sender: news@borland.com (News Admin) Organization: Borland International References: <1992Oct5.160022.29224@genghis.borland.com> <1992Oct6.020042.11130@cadsun.corp.mot.com> Date: Tue, 6 Oct 1992 17:41:29 GMT Lines: 32