-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automated Resyntax fixes #461
base: master
Are you sure you want to change the base?
Conversation
Keep imports in `require` sorted and grouped by phase, with collections before files.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
This `map` operation can be replaced with a `for/list` loop.
This `define-syntax` macro can be replaced with a simpler, equivalent `define-syntax-rule` macro.
`cond` with internal definitions is preferred over `if` with `let`, to reduce nesting
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
This `ormap` operation can be replaced with a `for/or` loop.
Using `cond` instead of `if` here makes `begin` unnecessary
Use the `#:when` keyword instead of `when` to reduce loop body indentation.
(and (pair? p) (equal? (car p) (car r)) (loop (cdr r) (cdr p))) | ||
(case mode | ||
[(get-path) | ||
`(,(cadr root+url+flags) ,@p |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jackfirth I'd rather see
(append (list (cadr root+url+flags))
p
(list (if ...)))
here.
In general, I think quasiquote should only be preserved if there exists an item that is not unquote / unquote-splicing. If all of them are unquote / unquote-splicing, either it should be converted to a list
or an append
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use a different rule for this. If I'm thinking of it as an sexpression, I'd use quasiquote and friends; if I'm thinking of it as a list, I'd use append and friends.
So maybe the quasiquote should be preserved by the tool and a user should make this judgment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's pretty fuzzy in a lot of cases, so Resyntax is conservative and only takes a hard stance on the cases that seem clearly absurd to me like this:
`(,a ,b ,c)
; just write `(list ...)` man, you're not fooling anyone
In the code you commented on, I would also prefer to avoid quotation for the same reason as you. But I dislike datum quotations generally and that's a much stronger stance than many Racketeers. So I don't think Resyntax should actively discourage it.
Resyntax fixed 20 issues in 10 files.
tidy-require
map-to-for
if-begin-to-cond
if-let-to-cond
ormap-to-for/or
cond-let-to-cond-define
when-expression-in-for-loop-to-when-keyword
let-to-define
define-syntax-syntax-rules-to-define-syntax-rule