Hi,
P3420's additions to reflection seems to enable the semantics I was contemplating for the decorator idea. The decorator syntax:
@my_decorator class MyClass { ... };
would call the conteval function my_decorator with the reflection
of the not-yet-defined class MyClass. my_decorator may use the
manipulation techniques of P3420 to inject whatever it likes
instead of the original MyClass declaration. This would work the
same for other types of declarations. The USP of the decorator
syntax is that you don't pollute the namespace with names that you
are not supposed to use. With the freedom that queue_injection
offers it would be possible to add the original declaration as
well as a modified version, _or_ only add the modified
declaration. For functions this will require a metafunction
body_of or something like that to inject the manually written
function body.
I don't really understand why P3420 is entitled Reflection of templates, isn't it more about manipulating declarations (although this in itself is more complicated for template declarations).
A function like prototype_of would work equally well for the reflection of a regular function, right?
I noted as a drawback of only having meta::info for all
reflections is that it is non-trivial to understand which actual
kind of reflection is valid for calling the new metafunctions. I'm
not saying that we should go back to multiple types, but rather
that it is important to document which kinds of reflections are
valid for each metafunction.
I'm looking forward to the SG7 discussions in Wroclaw!
Bengt
Hello,
Following discussions with implementers we have uploaded a revised version of P3420:
This is the version that will be discussed in SG7. See you soon!
-- Bengt Gustafsson