resyntax icon indicating copy to clipboard operation
resyntax copied to clipboard

Only use `#:when` and `#:unless` with multi-body loops

Open jackfirth opened this issue 3 months ago • 0 comments

Often, the unless-expression-in-for-loop-to-unless-keyword rule (and its corresponding when-based rule) rewrites this:

(for ([v (in-list vs)])
  (unless (good? v)
    (raise-arguments-error ...)))

to this:

(for ([v (in-list vs)]
      #:unless (good? v))
  (raise-arguments-error ...))

I don't think that's an improvement. I think these rules should only remove a when or unless from a loop if it has more than one body form inside it.

jackfirth avatar Nov 16 '25 04:11 jackfirth