Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Rete to inline helper/flatten patterns #171

Open
bergmanngabor opened this issue May 2, 2024 · 0 comments
Open

Allow Rete to inline helper/flatten patterns #171

bergmanngabor opened this issue May 2, 2024 · 0 comments
Labels
enhancement New feature or request Query Issues related to the query component of VIATRA, including runtime or pattern language issues.

Comments

@bergmanngabor
Copy link
Contributor

Rete does not do query flattening by default. There should be an opt-in way to specifically request certain helper patterns to be flattened (inlined) into calling patterns. For instance, this could apply to patterns marked as @Inline.

The main expected benefit is code conciseness - the ability to factor out helper patterns that are not enumerable (e.g. the whole pattern is just an eval). Reusable patterns currently have to be stand-alone queries with enumerable result sets. LS can do without this restriction, if certain parameters are marked as in parameters - with the guarantee that matches are enumerable for each specific binding of in-parameters. Rete can not handle parameter directions and will complain that a certain pattern body is not enumerable. A fully general solution would employ magic sets to ensure that Rete only computes results for specific combinations of in parameters. However, this is fairly involved improvement. A much simpler low-hanging-fruit solution (though perhaps less efficient for more complex helper patterns) would be inlining.

A secondary, minor improvement may be performance - maybe we can do with one fewer copy of the match set of the helper pattern if it is directly inlined.

@bergmanngabor bergmanngabor added enhancement New feature or request Query Issues related to the query component of VIATRA, including runtime or pattern language issues. labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Query Issues related to the query component of VIATRA, including runtime or pattern language issues.
Projects
None yet
Development

No branches or pull requests

1 participant