You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Draft: Resolve "Support DynamicFeature arguments to static Actions" - #197
In GitLab by @joergbrech on Dec 5, 2023, 16:20 UTC:
Note to self:
Currently, Action supports functors with overloaded call operators and function templates, because when I call grunk::action("id", some_func, a, b, c) I am passing in concrete argument types. From this information, I can implicitly instantiate the template, if some_func is a template. Also, I can query a concrete return value to initialize the result node of the compute node.
If some of the argument that I pass in are DynamicFeatures, I cannot instantiate a template, resolve an overload and in consequence I cannot determine the return type of the function template or overloaded function.
So I seem to have two choices:
Support DynamicFeature arguments to static Actions, but loose the support for function templates and overloaded functions
Support function templates and overloaded functions, but not DynamicFeature arguments to static Actions.
The best middle ground that I can imagine is: In grunk::action, if constexpr-check if the passed function can be invoked on the passed arguments. If yes, none of the arguments are reflect::DynamicObjects, or they are expected to be, and we can procede as always. If no, we check if the reason for this is that one or more arguments are DynamicFeature instances. Then we have to use reflect::details::function_traits to determine the return type and argument type so that we can cast the DynamicFeature instances to Feature<Arg> at some point. This means that we only loose support for function templates and overloaded functions in this scenario. We still need to think about how to cast the DynamicFeature instances to the expected type, but I suppose we could do something similar to what DynamicAction does with its list of evaluators.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In GitLab by @joergbrech on Dec 5, 2023, 13:03 UTC:
Closes #71
Migrated from GitLab: https://gitlab.dlr.de/paradigms/grunk/-/merge_requests/58