Toward an Introspection Open Standard

S

Steven T. Hatton

Has there been any substantial progress toward supporting
introspection/reflection in C++?

I don't intend to mean it should be part of the Standard. It would,
nonetheless, be nice to have a generally accepted means of providing
introspection.

My inclination is to have two general categories of introspection: dynamic
introspection, and static intospection. In situations where it makes sense
to use virtual functions and their associated vtbls, introspection would
probably be easier to provide and used. We could inherit from a common
base class (beware the diamond DAG). In situations where the overhead of
virtual function pointers is of significant consequence (highspeed
scientific and engineering programs) it may be possible to provide a means
of introspection similar to the way concepts are supported and used with
templates.

Ideas?


--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell
 
J

Jonathan Turkanis

Steven T. Hatton said:
Has there been any substantial progress toward supporting
introspection/reflection in C++?

I don't intend to mean it should be part of the Standard. It would,
nonetheless, be nice to have a generally accepted means of providing
introspection.

I think there's strong interest in adding (more) compile-time and runtime
reflection to C++. Bjarne Stroustrup specifically mentioned compile-time
reflection as an area of keen interest at the recent standards committee
meeting.

The problem is that C++ is a very complicated language, and so any adequate
reflection facility will also be very complicated-- much more complicated, e.g.,
than reflection in Java. People need to write proposals which are detailed
enough so that they can be sensibly evaluated. The proposals will then be
heavily criticized and need to be revised. If this process happens four or five
times, maybe a reflection facility will make it into the next standard.

Why don't you start by sketching some concrete proposals?

Jonathan
 
I

Ioannis Vranos

Jonathan said:
I think there's strong interest in adding (more) compile-time and runtime
reflection to C++. Bjarne Stroustrup specifically mentioned compile-time
reflection as an area of keen interest at the recent standards committee
meeting.

The problem is that C++ is a very complicated language, and so any adequate
reflection facility will also be very complicated-- much more complicated, e.g.,
than reflection in Java. People need to write proposals which are detailed
enough so that they can be sensibly evaluated. The proposals will then be
heavily criticized and need to be revised. If this process happens four or five
times, maybe a reflection facility will make it into the next standard.

Why don't you start by sketching some concrete proposals?



I do not know if you have the same thing in mind when using the term
reflection, however C++/CLI provides reflection support with the use of
attributes.

Attributes is a way to extend the language in a custom way.
 
H

Herb Sutter

Jonathan said:
I think there's strong interest in adding (more) compile-time and runtime
reflection to C++. Bjarne Stroustrup specifically mentioned compile-time
reflection as an area of keen interest at the recent standards committee
meeting.

The problem is that C++ is a very complicated language, and so any adequate
reflection facility will also be very complicated-- much more complicated, e.g.,
than reflection in Java. People need to write proposals which are detailed
enough so that they can be sensibly evaluated. The proposals will then be
heavily criticized and need to be revised. If this process happens four or five
times, maybe a reflection facility will make it into the next standard.

I know Bjarne (with Gaby Dos Reis) is actively working on an
implementation for type reflection and much more, including the ability to
represent a C++ program as a manipulatable structure. Cool stuff. That
project is called XTI, which IIRC stands for eXtensible Type Information.
XTI has been under development for several years, and I hear it's getting
close to a state where it can be used and presented. I won't say more
about it, in part because I don't know more about it :), and in part
because the details are Bjarne's and Gaby's news to release when they're
ready.

Herb

---
Herb Sutter (www.gotw.ca) (www.pluralsight.com/blogs/hsutter)

Convener, ISO WG21 (C++ standards committee) (www.gotw.ca/iso)
Contributing editor, C/C++ Users Journal (www.gotw.ca/cuj)
Architect, Developer Division, Microsoft (www.gotw.ca/microsoft)
 
J

Jonathan Turkanis

Herb Sutter said:
I know Bjarne (with Gaby Dos Reis) is actively working on an
implementation for type reflection and much more, including the ability to
represent a C++ program as a manipulatable structure. Cool stuff. That
project is called XTI, which IIRC stands for eXtensible Type Information.
XTI has been under development for several years, and I hear it's getting
close to a state where it can be used and presented. I won't say more
about it, in part because I don't know more about it :), and in part
because the details are Bjarne's and Gaby's news to release when they're
ready.

Yes, I've heard of this project, and I'm eager to know what it will look like.
My impression was that not much work had been done on it recently, but I am
happy to hear otherwise.

Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top