Hi, I would first like to preface this post with I don’t expect this to be a 5.8 or 5.9 or any 5.x version feature necessarily as it would almost certainly be a massive undertaking to implement. But for a potential UE6 I think it could be a game changer and worth considering now in time for that.
The C++ standards commitee recently certified C++ reflection, which is a huge language feature that will open the door for more complex and powerful meta-programming. Herb Sutter of C++ fame has been evangelising for the feature for a while now and it’s hard to ignore it’s potential impact. From my limited knowledge of the feature one of the things I think it could be useful for is replacing the slew of macros that the C++ API uses as well as providing tighter integration with the editor through more complex reflection functions.
It’s not part of the standard yet, but there is a proposal for some syntax sugar for applying reflection functions to classes. If accepted (which I hope it will be) then you standard C++ Unreal class could go from:
UCLASS()
class ACameraController : public APawn
{
GENERATED_BODY()
// rest of class
}
to
class(UClass) ACameraController : public APawn {
// rest of class
}
And ditch the GENEREATED_BODY() macro entirely as it would be part of the code generation stage.
I could also see a potential alternative where the uclass is ditched entirely and replaced with the thing you want to inherit directly, e.g.:
class(APawn) ACameraController {
// rest of class
}
And code generation would handle the inheritance, etc. Other examples of where this could be useful would be with class properties and blueprint integration. And even though it’s compile time reflection only, it still will help with runtime reflection as you can generate runtime type information at compile time to be used at runtime.
Of course before all of this the tooling for reflection needs to catch up. For proper IntelliSense support there would need to be a similar feature to macro expansion. But I imagine those will come eventually anyway.
Edit: Found the C++ proposal here
Edit 2: Bonus points if you swap to C++ named modules and import std; at the same time