|
Boost : |
Subject: Re: [boost] [OT][RFC] standardized compile-time reflection
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2012-04-23 13:24:20
> > Since this is compile-time reflection, can't the compiler generate reflection
> > metadata "on demand" (that is, whenever it is being queried) rather than
> > the user having to explicitly mark classes as reflected, without any loss of
> > efficiency?
>
> This is actually mentioned in the "Implementation hints" section, and yes
> the compiler should generate meta-data lazily, but the problem is that
> I would like to be able to traverse the members of a scope (namespace,
> class, ...). You can imagine what would happen if such operation
> instantiated for example ALL members of the boost or std namespace.
I see, good point.
> There are some ideas on how to solve this in the "Unresolved issues"
> section but it is rather complicated:
>
> - If we allow everything to be reflected the compile-times would
> be horrible, even worse if a run-time reflection facility was based
> on this meta-data so would be the resulting executable size.
>
> - If we allow some sort of "white-listing" (i.e. specify what you want)
> or "black-listing" (specify what you don't want) it would be inconvenient
> for some use-cases.
>
> I'm a fan of the "white-list" approach, but I would like to hear your opinions
> on this issue.
Whitelisting seems appropriate. To make it more convenient, it would be
nice to be able to white-list at different granularities - for example, an
entire namespace (meaning all its contents), or just particular elements of
a namespace.
I also like the idea of separating the whitelisting from the definition of the
namespace/class. For example, I may *want* to traverse all the elements
of namespace std, so I should be able to whitelist it in my code only.
Regards,
Nate
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk