Toward an Introspection Open Standard

Discussion in 'C++' started by Steven T. Hatton, Oct 25, 2004.

  1. 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
     
    Steven T. Hatton, Oct 25, 2004
    #1
    1. Advertisements

  2. 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
     
    Jonathan Turkanis, Oct 25, 2004
    #2
    1. Advertisements



  3. 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.
     
    Ioannis Vranos, Oct 25, 2004
    #3
  4. Steven T. Hatton

    Herb Sutter Guest

    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)
     
    Herb Sutter, Oct 25, 2004
    #4
  5. 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
     
    Jonathan Turkanis, Oct 25, 2004
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.