-
Notifications
You must be signed in to change notification settings - Fork 138
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 passing arbitrary data from Searcher
s to Applier
s
#131
Comments
Ideally I think |
Yeah, that's definitely awkward. I like your proposed design, but it would be a pretty major rework. If So we'll need a trait Maybe we could get around this with some I also thing the |
I am working on a solution for this. It should help a bunch of other things too. |
Has there been any progress on this? It would be helpful in my use-case too. |
Nothing has been upstreamed yet, but I have developed a useful change in a fork for another project. I hope to upstream it eventually! https://github.com/mwillsey/egg/tree/varargs |
Currently a
Searcher
can only pass data to anApplier
in aSubst
, which limits that data to a map fromVar
s toId
s. This makes it fairly awkward to createRewrite
s that don't work likePattern
s. For example, I have a rewrite rule where theSearcher
partitions the children of a node into two disjoint sets. So for an enode like(+ 1 2 4 5 11 12)
I had two sets like{1, 5, 11}
and{2, 4, 12}
. To pass this information to the rule'sApplier
, I had to create a subst like this:And then in the
Applier
create a loop likewhich is not ideal. It would be much nicer if I could just pass the two sets directly, or any other data that might be important for a particular rewrite rule.
The text was updated successfully, but these errors were encountered: