Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!att!cbnewsl!dog From: dog@cbnewsl.ATT.COM (edward.n.schiebel) Newsgroups: comp.lang.c++ Subject: Re: What to do about generics and polymorphism in C++ Message-ID: <4731@cbnewsl.ATT.COM> Date: 23 Mar 90 17:37:10 GMT References: <16808@well.sf.ca.us> Organization: AT&T Bell Laboratories Lines: 42 From article <16808@well.sf.ca.us>, by nagle@well.sf.ca.us (John Nagle): > > Let's start a discussion about the problem of how to achieve > generic objects (ones with types as parameters, at least at compile > time) in C++. Some possibilities: > > 3. Add compile-time generic facilities along the lines of those > in Ada to the language. Provides similar functionality to > #2, with proper checking and diagnostics, but requires > a language change. > This is my choice. Although I am not at all familiar with Ada, I assume you are refering to an implementation generics similar to parameterized types described by Bjarne in some paper I can't find right now. It seems to me that parameterized types provide the type saftey (as opposed to using void*'s) and the run-time efficiency (vrs. types as first-class objects) that makes the most sense within the C++ language. C++'s contributors have always taken these two concerns very seriously throughout the language's evolution, and I don't expect them to stop now. I have used and written (with more or less success) generic types based on the preprocessor and I must say that it is an interim solution at best. Nonetheless, the generic types created by that scheme are a fair approximation of pramaterized types, and I have come to rely on that kind of capability. From the first Usenix C++ Workshop (my first real introduction to the language) to the last OOPSLA, and probably through this years Usenix conference (see you there), all I have heard is "what about generics" "what about exception handling" "what about garbage collection"? I don't even want to get another garbage collection discussion started, and between the other two, for my money, I would like to see parameterized types implemented first. I believe they would be adopted and used by more programs much quicker than exception handling and would provide the greatest benefit to C++'s users. Ed Schiebel AT&T Bell Laboratories dog@cblph.att.com