-
-
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 #469
Conversation
Keep imports in `require` sorted and grouped by phase, with collections before files.
The `provide/contract` form is a legacy form made obsolete by `contract-out`.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
…ellipses` This `->*` contract can be rewritten using `->` with ellipses.
This `map` operation can be replaced with a `for/list` loop.
This variable is returned immediately and can be inlined.
Use the `#:when` keyword instead of `when` to reduce loop body indentation.
This `begin` form can be flattened into the surrounding definition context.
Using `when` and `unless` is simpler than a conditional with an always-throwing branch.
empty | ||
(cons/c rc rc)))) | ||
rc) | ||
(recursive-contract (or/c c empty (cons/c rc rc)))) |
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.
Whoa!
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 this needs a side condition to make sure that rc
doesn't occur in the body of define
.
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.
Fixed in jackfirth/resyntax#438.
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.
If the inlined definition binds a (non-recursive) lambda expression, would the name be lost?
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.
Yes, but that doesn't happen because first those get rewritten into function definitions of the form (define (f) ...)
(as opposed to (define f (lambda () ...))
). Then, there's a check in the inlining rule to not inline function definitions, only variable definitions.
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.
Wow, this is very cool!
Resyntax fixed 20 issues in 5 files.
provide/contract-to-contract-out
when-expression-in-for-loop-to-when-keyword
let-to-define
tidy-require
inline-unnecessary-define
inline-unnecessary-begin
always-throwing-if-to-when
map-to-for
arrow-contract-with-rest-to-arrow-contract-with-ellipses