Rework definition context rules

Open
#477 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Domain
tooling

Research direction

Start with the define-definition-context-refactoring-rule entry point and review issue #476 to understand the replacement problems described here. Compare its current behavior with the Rhombus statement-macro model mentioned in the issue. Done would mean a decided and implemented approach that avoids requiring callers to manage replacement forms and no longer depends on hard-coded definition-context forms.

Written by the indexing model from the issue text.

Description

enhancement

Creating a definition context rule with define-definition-context-refactoring-rule is somewhat awkward. There's a few usability issues:

  • You have to match the entire definition context, which is rarely useful.
  • You have to be careful to use ~replacement, ~splicing-replacement, and ~focus-replacement-on in order to avoid issues like #476.
  • The set of recognized definition context forms is hard-coded.

Something better should be possible. Perhaps something like how Rhombus macros work, where a statement macro can match on all following statements and statement macros return two values: an expansion and an "unprocessed tail". That would let Resyntax automatically use ~replacement, ~splicing-replacement, and ~focus-replacement-on, and it would remove the need for definition context rules to care about the forms earlier in the definition context.

Dominant language
Racket
Stars
70
Forks
11
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jackfirth/resyntax

All issues in jackfirth/resyntax

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.