Related articles |
---|
C++ Reflection package? mihai@cs.ucsb.edu (Mihai Christodorescu) (1999-04-01) |
Re: C++ Reflection package? mal@bewoner.dma.be (Lieven Marchand) (1999-04-03) |
Re: C++ Reflection package? dormouse@teapot.com (Hao-yang Wang) (1999-04-03) |
Re: C++ Reflection package? olivier.lefevre@wdr.com (Olivier Lefevre) (1999-04-06) |
From: | Lieven Marchand <mal@bewoner.dma.be> |
Newsgroups: | comp.compilers |
Date: | 3 Apr 1999 21:57:20 -0500 |
Organization: | Only under extreme pressure |
References: | 99-04-004 |
Keywords: | C++ |
Mihai Christodorescu <mihai@cs.ucsb.edu> writes:
> I was wondering whether there is such a beast as a reflection
> (in the Java DevKit sense) library for C++. As far as I can figure out
> (and I have not spent too much time on the topic), one would be able
> to extract such information only from object files / shared libs that
> were compiled with debug info. I know RTTI lets you query whether an
> object is of a certain type. But I want to extract some textual
> information about the class.
>
Before Java called it reflection Lispers called stuff like that a meta
object protocol. An implementation for C++ is OpenC++ at
http://www.softlab.is.tsukuba.ac.jp/~chiba/openc++.html
One comprehensive starting point for MOPs is
http://www.parc.xerox.com/spl/projects/mops/default.html although they
have now broadened their research to a concept they call Open
Implementation.
PS: I presume you are aware that RTTI only is guaranteed to work on
classes with at least one virtual function?
> PS. On a completely different topic, is it possible to manipulate
> namespaces in C++ (i.e. add/remove/replace classes in a namespace)?
Do you mean at compile time or at run time? I think the name lookup
rules for C++ are too complex to allow manipulating namespaces at run
time. It would force an interpreter based system since you would have
to reparse everything to know to what the functions resolve to after
changing anything in a namespace.
--
Lieven Marchand <mal@bewoner.dma.be>
Return to the
comp.compilers page.
Search the
comp.compilers archives again.