home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:11616 comp.std.c++:964
- Newsgroups: comp.lang.c++,comp.std.c++
- Path: sparky!uunet!darwin.sura.net!mips!mips!rtech!ingres!bobm
- From: bobm@Ingres.COM (Bob McQueer)
- Subject: Re: Language extensions for run-time type identification
- Message-ID: <1992Jul27.180115.1889@pony.Ingres.COM>
- References: <1992Jul24.070325.1597@uunet.uu.net!mole-end>
- Date: 27 Jul 92 18:01:15 GMT
- Lines: 31
-
- In <1992Jul24.070325.1597@uunet.uu.net!mole-end>,
- dated Fri, 24 Jul 1992 07:03:25 GMT,
- mat@uunet.uu.net!mole-end writes:
-
- > And not to make you too happy: comparing vtable pointers could only be
- > a first step unless you are absolutely sure that the compilation and
- > linking system will never duplicate a vtable. This is a hard assumption
- > to prove, especially with dynamic linking of new types.
-
- I think it is just a first step anyway - when I want to know at run time if
- an object is of a particular class, what I really want to ask is "is it this
- class, or any class derived from it?", which implies somebody taking the
- vtable (enhanced into class descriptor) pointer in the object instantiation,
- and ascending through its parents. With multiple inheritance, there can be
- several flavors of this question.
-
- As has already been said, this sort of thing can be abused, and is not a
- substitute for proper use of virtual methods, but it IS useful.
-
- I would also like to see the ability to parameterize the type handed
- to the "new" operator - logically, this thing is a class descriptor also.
-
- Perhaps the committee ought to be considering the various sorts of "meta"
- operations people want to perform which involve parameterization of or
- manipulation of type information, and see if we shouldn't surface the idea
- of a "class descriptor" object of some sort as a formal part of the language?
-
- I have not been using C++ extensively, but for the past couple years I have
- been using another C based OO paradigm. I have found that there are a certain
- number of operations (yes, PARTICULARLY for debuggers) in which a formal idea
- of a type object with appropriate methods is indispensible.
-