-
Notifications
You must be signed in to change notification settings - Fork 92
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
Make RuleTransformer fully recursive [#257] #421
Conversation
RuleTransformer for the past eleven years or more has first recursed, then applied the rewrite rules as it backed out of the recursion. That prevented rewrite rules from acting on changes of previous rules unless they recursed themselves. The workaround has always been chain rule transformers instead of calling one rule transformer with all the rules. This change basically re-implements RuleTransformer as that workaround, and introduces a NestingTransformer which does the nesting. Clearly, if you have N rules you'll now recurse N times instead of once, though each rule is still only applied once for each element. On the other hand, a RewriteRule that recursed would incur in exponential times, and now they don't need to. The original behavior has no reason to be. It didn't prevent rules from seeing each other changes, nor was it particularly concerned with performance. With API changes coming on 2.0, I believe this is the right time to introduce this change.
Fixes #257 |
is there someone watching this repo who could review this...? |
And there was a deafening silence... |
@SethTisue I rely on the tests. I've always found it hard to reason about the XML transformation code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah. seems fair game to me for 2.0, but let's give Aaron a week or two to object, perhaps he knows something you and I don't
It's been 18 days now. |
another backstop is the community build; I've included this change here: scala/community-build#1333 |
RuleTransformer for the past eleven years or more has first recursed,
then applied the rewrite rules as it backed out of the recursion.
That prevented rewrite rules from acting on changes of previous rules
unless they recursed themselves.
The workaround has always been chain rule transformers instead of
calling one rule transformer with all the rules. This change basically
re-implements RuleTransformer as that workaround, and introduces
a NestingTransformer which does the nesting.
Clearly, if you have N rules you'll now recurse N times instead of
once, though each rule is still only applied once for each element.
On the other hand, a RewriteRule that recursed would incur in
exponential times, and now they don't need to.
The original behavior has no reason to be. It didn't prevent
rules from seeing each other changes, nor was it particularly
concerned with performance. With API changes coming on 2.0, I
believe this is the right time to introduce this change.