Skip to content
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 #714

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Automated Resyntax fixes #714

wants to merge 8 commits into from

Conversation

resyntax-ci[bot]
Copy link
Contributor

@resyntax-ci resyntax-ci bot commented Jan 19, 2025

Resyntax fixed 20 issues in 6 files.

  • Fixed 10 occurrences of let-to-define
  • Fixed 2 occurrences of provide/contract-to-contract-out
  • Fixed 2 occurrences of if-else-false-to-and
  • Fixed 2 occurrences of when-expression-in-for-loop-to-when-keyword
  • Fixed 1 occurrence of cond-else-cond-to-cond
  • Fixed 1 occurrence of send-chain-to-send+
  • Fixed 1 occurrence of make-temporary-directory-migration
  • Fixed 1 occurrence of cond-let-to-cond-define

resyntax-ci bot added 8 commits January 19, 2025 00:10
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
The `provide/contract` form is a legacy form made obsolete by `contract-out`.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
This `if` expression can be refactored to an equivalent expression using `and`.
The `else` clause of this `cond` expression is another `cond` expression and can be flattened.
Use the `#:when` keyword instead of `when` to reduce loop body indentation.
This method chain made of nested `send` expressions can be written more clearly as a `send+` expression.
Use `make-temporary-directory` to make directories instead of `make-temporary-file`.
[use-get/put-dialog (-> (-> any) path? void?)]
[set-module-language! (->* () (boolean?) void?)])
(provide (contract-out [use-get/put-dialog (-> (-> any) path? void?)]
[set-module-language! (->* () (boolean?) void?)]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like another situation where we are missing some newlines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(raise x))])
(fw:preferences:set 'framework:file-dialogs 'common)
(open-dialog)
(let ([dlg (wait-for-new-frame drs)])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come this let didn't go away?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have been asking this a lot. I think one thing that would help is for the PR description to indicate if there's any limitation reached. If so, we wouldn't need to ask anymore if it's Resyntax's fault or not when some issues are not fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like a great idea.


(clear-definitions drr-frame)
(do-execute drr-frame)
(queue-callback/res (λ () (+ 1 (send ints-text last-position))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this can just go away!

(drracket-frame? active))
active
#f))
(and (and active (drracket-frame? active)) active))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only need one and here, but maybe that's out of the scope of this improvement?

(drracket-frame? active))
active
#f))
(and (and active (drracket-frame? active)) active))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto (copied code, I wonder?!)

[(method-in-interface? 'get-stacks (object-interface snip))
(define-values (s1 s2) (send snip get-stacks))
(list* s1 s2 (loop (send snip next)))]
[else (loop (send snip next))])))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is not a good change. This is going against the data definition. That is, the outer cond is part of the processing of snip (there are two cases for the input and, in the second case of the input, I want to do a conditional thing).

@@ -64,7 +64,7 @@ and then loading the framework after that.
(define drr-frame (wait-for-drracket-frame))
(set-module-language! drr-frame)
(queue-callback/res
(λ () (send (send (send drr-frame get-definitions-text) get-canvas) focus)))
(λ () (send+ drr-frame (get-definitions-text) (get-canvas) (focus))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this one is a good change, actually. It isn't like the example in the documentation for send+ where we're getting objects of the same type back and doing functional update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants