Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!ub!oswego!news From: dl@g.g.oswego.edu (Doug Lea) Newsgroups: comp.std.c++ Subject: Re: the most dissatisfying part of c++ Message-ID: Date: 3 Aug 90 14:55:20 GMT References: <27634@netnews.upenn.edu> <10656@crdgw1.crd.ge.com> Sender: news@oswego.Oswego.EDU (Network News) Reply-To: dl@g.oswego.edu Organization: SUNY Oswego Lines: 40 In-reply-to: brownpc@sunne.crd.ge.com's message of 1 Aug 90 21:02:00 GMT My `Customization in C++' paper in the '90 Usenix C++ Proceedings discusses a reasonably clean, but extensive proposal that would support the desired usage: #include class a { public: template a& test() { // *** Note the qualifier *** // do some modification to the state of this object, // then ... return *this; }; class b : public a { public: int b; }; main() { b B; B = B.test(); // *** Legal under customization *** // type violation despite the fact that // `B' and `B.test()' are the same object. } While I played down the expressivity aspects of the type qualifier sense of `template' and concentrated on optimization consequences, the proposed constructs are indeed extremely valuable for writing container classes and the like. I'd love to hear from anyone concerning the standardizability of the proposal. -Doug -- Doug Lea, Computer Science Dept., SUNY Oswego, Oswego, NY, 13126 (315)341-2688 email: dl@g.oswego.edu or dl@cat.syr.edu UUCP :...cornell!devvax!oswego!dl or ...rutgers!sunybcs!oswego!dl