Deep partial evaluation for CLEF expression #93
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.
During a partial evaluation, the operation is explicitly called at each node, instead of simply evaluating the children and waiting for all the arguments to be known (non lazy) to do the operation (previous behavior).
This is disabled by default for the tags::function and tags::subscript node, i.e. () and [] call operators.
However, if the traits supports_partial_eval_of_calls/supports_partial_eval_of_subscript are set to true for an object the ()/[] is called during the partial evaluation.
It is not set by default since writing a partial evaluation for an object requires a bit of care, i.e. to properly move the arguments into the make_expr_call object. At this stage, it is only intended for advanced users, and for some specific cases where a partial evaluation of the function can compress it significantly for performance.
To illustrate the previous point, a simple lambda add(auto x, auto y) { return x + y;} used in a node {function, add, x_, y_} would compile with the new behavior, but after a partial eval on y= y0, its value y0 would be dangling. As it is unlikely that default user will write add with a move, the new behavior is not by default for ()/[]
NB : put the partial eval for call by default compiles but breaks 2 tests in TRIQS lib.