Description
Resyntax relies on the expander to find what forms it should analyze. This means that macros which circumvent the expander, like for
, match
, and syntax-parse
, can hide forms from Resyntax. This is why Resyntax can't currently refactor (in-range a (add1 b))
to (in-inclusive-range a b)
when inside a for
clause. Similar issues exist for refactoring match
patterns and syntax-parse
patterns.
A fix to this would be to extend Racket with a 'disappeared-visit
property, similar to the 'disappeared-use
property, that macros can attach to syntax objects produced during "manual expansion". Integration with syntax-local-apply-transformer
would also be nice. The syntax property should contain the syntax object that the macro manually expanded. In the case of for
, that would be the right-hand-side of clauses when they contain sequence transformers. Resyntax can then search for this property in expanded code to find expansion visits that weren't otherwise visible.