Allow Rete to inline helper/flatten patterns #171
Labels
enhancement
New feature or request
Query
Issues related to the query component of VIATRA, including runtime or pattern language issues.
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.
The text was updated successfully, but these errors were encountered: