Runtime introspection, or how to get class members at runtime Fin D
Steven Schveighoffer
schveiguy at yahoo.com
Wed Jun 6 14:38:23 UTC 2018
On 6/6/18 9:28 AM, Arafel wrote:
> Hi,
>
> What is the state of runtime introspection in D, specifically for
> classes? Is there any way to get *at runtime* the (public or otherwise
> accessible) members of a class?
There is very little runtime reflection capability. The position has
always been that you can *build* runtime reflection given compile-time
reflection.
object has rtInfo, as Adam says, which is built to be able to extend
TypeInfo. But at the moment, it's not used for anything, and likely will
stay that way for a while.
Note, you CAN build runtime reflection using mixins, but other than
rtInfo, there's no way to instrument modules you don't control. Even
that's a high bar, since you would then have to have a modified druntime.
-Steve
More information about the Digitalmars-d-learn
mailing list