Shareable metafunctions and metafunctions for more than just types #1350
Unanswered
LouChiSoft
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Some related conversations:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Metafunctions are probably my favourite feature in Cpp2 and I know that there is work being done to allow users to define their own custom metafunctions. But I was wondering if there had been any talk about how they could be shared. Is it going to be a source code only kind of thing? Or maybe you can get a metafunction in some kind of compiled function that is ran by the compiler at compile time.
I was also wondering if there have been discussions about enabling the user of metafunctions for more than just a type definition. The use case I am thinking of comes from things like Unreal and Godot. Both engines make use of macros in both their C++ APIs to add the required boiler plate code for various things in a class.
Unreal example:
It would be interesting to see metafunctions be usable inside a class to replace the properties as well. e.g.
Not a fully indepth example, and I am sure there will be syntax errors in there but it demonstrates the intent. With Godot it could be even more useful, since in Godot when you want to expose a value in the editor you not only have to manyally define a getter and setter like Unreal, but you then have to manually write a
_bind_methods_
function where you bind the methods to the property in question so the editor can read and write them, e.g.Godot example:
Could become:
Again, almost certain has syntax errors, sorry. But I still think there is potential here for more than just type defintion metafunctions and can feature as a more fully feature replacement to the pre-processor which doesn't exist in non-backwards compatible Cpp2.
Any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions