resyntax icon indicating copy to clipboard operation
resyntax copied to clipboard

Replace `syntax->list` with `attribute`

Open jackfirth opened this issue 1 year ago • 0 comments

When using syntax-parse, ellipses-bound pattern variables are often converted to lists using (syntax->list #'(var ...)) but they can be extracted as lists directly using (attribute var). There should be a rule for this.

#lang resyntax/test

test: "syntax->list with #'(var ...) refactorable to (attribute var)"
--------------------
#lang racket
(syntax-parse #'(a b c)
  [(id ...) (syntax->list #'(id ...))])
--------------------
--------------------
#lang racket
(syntax-parse #'(a b c)
  [(id ...) (attribute id)])
--------------------

jackfirth avatar Oct 16 '24 19:10 jackfirth