Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: Misuses of ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 16 of 34 Topic 9585 of 10094
Post > Topic >>

Re: Misuses of RTTI

by Mathias Gaunard <loufoque@[EMAIL PROTECTED] > May 14, 2008 at 12:55 PM

On 14 mai, 05:12, galathaea <galath...@[EMAIL PROTECTED]
> wrote:
> On May 10, 5:14 am, Francis Glassborow
> > It was at that point (around 1994) that RTTI was added.
>
> and it failed horribly to provide what was needed
>
> what was needed was enough introspection to automate serialisation

No.
RTTI is not introspection.
RTTI, as the name says, is just a way to identify types at runtime.
Bundling it in the language allows to reuse the pointer to the vtable
of polymorphic objects as identifiers.

The only way it fails, in my opinion, is that typeid(SomeType) is not
a constant expression, preventing usage in switch/cases.

> i.e.
>    - a way to automatically get an identifier for an object
>      that _uniquely_ identified it's type across runtimes

It does identify it uniquely.
The fact that it may not work across different implementations is
irrelevant.


>    - a means of enumerating
>        and iterating
>      over the member variables and up the inheritance hierarchy

That was *never* the goal of RTTI.
That kind of thing is provided at compile-time (much more useful than
at runtime) by tuples, and you can trivially add it to your own types
with Boost.MPL for example.

That kind of facility is only useful in generic programming. Maybe


> neither of these objectives were fulfilled

That's good, since these were *not* the objectives.
I'm happy RTTI wasn't even more bloated by useless runtime
introspection data.


> i'm still not positive any of this will be possible in c++0X

Iterating over the member variables of any class type won't be in C+
+0x, no.
It wouldn't be too complicated, but first you'd probably have to add
Boost.MPL or better in the standard library.

Ideally you could also have sup****t of typedefs, member variables
(overloads, templates...) etc. With good introspection you could
easily reimplement concepts, and more.


-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 34 Posts in Topic:
Misuses of RTTI
OuFeRRaT <ouferrat@[EM  2008-05-09 21:13:35 
Re: Misuses of RTTI
Pavel Minaev <int19h@[  2008-05-10 05:52:08 
Re: Misuses of RTTI
Mathias Gaunard <loufo  2008-05-10 05:53:41 
Re: Misuses of RTTI
brangdon@[EMAIL PROTECTED  2008-05-10 06:14:41 
Re: Misuses of RTTI
Francis Glassborow <fr  2008-05-10 06:14:40 
Re: Misuses of RTTI
MiB <Michael.Boehnisch  2008-05-10 14:08:42 
Re: Misuses of RTTI
"Bo Persson" &l  2008-05-11 16:40:58 
Re: Misuses of RTTI
Carl Barron <cbarron41  2008-05-11 22:13:29 
Re: Misuses of RTTI
=?UTF-8?B?RXJpayBXaWtzdHL  2008-05-13 10:55:29 
Re: Misuses of RTTI
galathaea <galathaea@[  2008-05-13 21:12:13 
Re: Misuses of RTTI
Gerhard Fiedler <gelis  2008-05-13 21:27:28 
Re: Misuses of RTTI
bravo <szymon.gatner@[  2008-05-14 08:36:57 
Re: Misuses of RTTI
brangdon@[EMAIL PROTECTED  2008-05-17 02:27:45 
Re: Misuses of RTTI
Tony Delroy <tony_in_d  2008-05-14 08:38:14 
Re: Misuses of RTTI
Mathias Gaunard <loufo  2008-05-14 12:27:28 
Re: Misuses of RTTI
Mathias Gaunard <loufo  2008-05-14 12:55:43 
Re: Misuses of RTTI
anthonypon@[EMAIL PROTECT  2008-05-15 02:47:07 
Re: Misuses of RTTI
Greg Herlihy <greghe@[  2008-05-15 11:21:05 
Re: Misuses of RTTI
dizzy <dizzy@[EMAIL PR  2008-05-15 11:57:29 
Re: Misuses of RTTI
dizzy <dizzy@[EMAIL PR  2008-05-15 11:57:29 
Re: Misuses of RTTI
Edward Diener <diener8  2008-05-15 15:57:15 
Re: Misuses of RTTI
Mathias Gaunard <loufo  2008-05-16 17:30:34 
Re: Misuses of RTTI
Frank Birbacher <blood  2008-05-16 17:44:13 
Re: Misuses of RTTI
Daniel James <wastebas  2008-05-16 17:43:20 
Re: Misuses of RTTI
"Marcin Kalicinski&q  2008-05-17 02:57:29 
Re: Misuses of RTTI
Edward Diener <diener8  2008-05-17 14:38:55 
Re: Misuses of RTTI
Greg Herlihy <greghe@[  2008-05-17 14:36:47 
Re: Misuses of RTTI
Edward Diener <diener8  2008-05-17 14:39:16 
Re: Misuses of RTTI
Andre Kaufmann <akfmne  2008-05-17 14:38:10 
Re: Misuses of RTTI
Andre Kaufmann <akfmne  2008-05-17 23:20:59 
Re: Misuses of RTTI
Daniel James <wastebas  2008-05-18 16:48:55 
Re: Misuses of RTTI
Andre Kaufmann <akfmne  2008-05-19 06:05:40 
Re: Misuses of RTTI
Francis Glassborow <fr  2008-05-19 12:01:47 
Re: Misuses of RTTI
Francis Glassborow <fr  2008-05-20 18:59:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 8:06:33 CDT 2008.