resyntax icon indicating copy to clipboard operation
resyntax copied to clipboard

Refactor rhs of refactor rules

Open Metaxal opened this issue 5 years ago • 0 comments

Imagine someone writes the following rule:

(define-refactoring-rule smurf
  #:literals (if begin)
  [(smurf x x y z)
   (if x y (void))])

but, unbeknownst to the someone above, the following happens to exist already:

(define-refactoring-rule if-to-when
  #:literals (if begin)
  [(if x y (void))
   (when x y)])

There should be no need to ask the someone to refactor its rule. Instead we should be able to apply a set of existing rules to a new rule so as to simplify it directly.

After no simplification is possible anymore, we should check that the rule is the identity rule (that is, existing rules can already do the same work as this 'new' rule).

Metaxal avatar Jan 12 '21 19:01 Metaxal