jackfirth / resyntax

A Racket refactoring engine
Apache License 2.0
51 stars 10 forks source link

Split `define-values` into individual definitions #205

Closed jackfirth closed 1 year ago

jackfirth commented 1 year ago

Saw this code today:

(define-values (ans j seen)
  (values 0 -1 (make-hash)))

Resyntax should suggest splitting that into separate definitions:

(define ans 0)
(define j -1)
(define seen (make-hash))
Metaxal commented 1 year ago

I often use define-values for things like:

(define-values (f xmin xmax)
  #;(values (λ (x) (+ x 2)) 0 10)
  #;(values sqr -10 10)
  (values / 0.01 100)
  )

in which case I would certainly not want resyntax to refactor. Admittedly, this is mostly in colab-like scripts, not libraries.

jackfirth commented 1 year ago

Given that Resyntax won't perform refactorings that drop comments, in that case you'd be safe.