Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!linac!att!cbnewsh!warren From: warren@cbnewsh.att.com (warren.a.montgomery) Newsgroups: comp.lang.c++ Subject: Re: asking an object for its type Summary: If we can't easily ask an arbitrary object it's type, maybe there should at least be a standard way of generating run-time type information where it is needed. Message-ID: <1991Feb22.231956.16475@cbnewsh.att.com> Date: 22 Feb 91 23:19:56 GMT References: <23984@netcom.COM> <1190@sheol.UUCP> <1991Feb22.195826.14008@gpu.utcs.utoronto.ca> Organization: AT&T Bell Laboratories Lines: 22 It seems impossible to satisfy everyone here, since the real problem is that any implementation capable of supplying type information given only an anonymous pointer must be keeping type information (overhead) in every object. One step that could be taken, though, would be to provide some standard way for the writer of a class to generate run-time type information where they do it. What I am talking about is a standard way of generating a standard member containing a pointer to a class structure describing the members (functions and data) of the object in some standard way. I've looked at some library code (NIH, I think) that does this by severe abuse of the pre-processor. This kind of stuff works, but it's error prone and not reliable. If there were a standard way of generating symbolic information like this and a standard for how it was to look, I think that the result would go a long way towards satisfying the needs of people who have seen the power that this information gives Lisp and Smalltalk, and find it lacking in C++. -- Warren Montgomery att!ihlpf!warren