Resyntax: an automated refactoring tool for Racket

51 Aufrufe
Direkt zur ersten ungelesenen Nachricht

jackh...@gmail.com

ungelesen,
25.01.2021, 02:24:3125.01.21
an Racket Users
Hello everyone! Just wanted to announce a neat project I've been working on: Resyntax, a tool for refactoring racket code. Currently the tool is able to replace various uses of `let` forms with `define`, as can be seen in this pull request.

The tool works by hooking in to the racket macro expander and applying refactoring rules to the code as it's being expanded, where a refactoring rule is a syntax-parse macro that says how to rewrite some code pattern. You can see all of the refactoring rules I've implemented so far in the resyntax/refactoring-rule module.

Resyntax is in the early stages. It works well enough when run manually on single files, and it has some nice features already:
  • Output is correctly indented
  • Rules are hygienic, so Resyntax's rules for replacing `let` with `define` won't run on code where `let` is bound to something other than the `let` from `racket/base`.
  • If a rule leaves a subform untouched, the formatting of that form is left completely unchanged by the tool.
But it's got some issues that need to be worked out:
  • No public API for running it.
  • No documentation on how to create your own refactoring rules.
  • Deletes comments sometimes.
  • Doesn't enforce that code produced by a refactoring rule actually compiles.
  • Current rules are not all that robust yet and may sometimes produce buggy or badly formatted code.
If you're interested in following along with Resyntax's development, see the github repository. If you've got some suggestions for rules, follow the guidance in this github issue to tell me all about your ideas. And, as usual, I can be reached by email and in the racket Slack and Discord servers.
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten