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

[util] Add util/respond-to #920

Merged
merged 1 commit into from
Mar 14, 2025
Merged

[util] Add util/respond-to #920

merged 1 commit into from
Mar 14, 2025

Conversation

alexander-yakushev
Copy link
Member

There is a very common pattern used everywhere in cider-nrepl:

(transport/send (:transport msg) (response-for msg ...))

This PR commemorates this pattern as a function respond-to and replaces all matching usages with it. Perhaps, this is something that could live in nREPL itself, but we'll still have to support older versions of nREPL here, so might as well add it here.

@alexander-yakushev alexander-yakushev force-pushed the respond-to branch 3 times, most recently from 4beb7f9 to 7817ee5 Compare March 13, 2025 21:23
@alexander-yakushev
Copy link
Member Author

Includes commits from a neighbouring PR, will merge after that one.

@bbatsov
Copy link
Member

bbatsov commented Mar 14, 2025

@alexander-yakushev Really good idea - I love the symmetry between response-for (a subject) and respond-to (an action).

I also thing it'd be prudent to include this in nREPL, even if we won't be able to use it directly for a while. This will allow to simplify a bit the built-in middleware, and that's always nice.

@alexander-yakushev alexander-yakushev merged commit 49145e6 into master Mar 14, 2025
16 checks passed
@alexander-yakushev alexander-yakushev deleted the respond-to branch March 14, 2025 15:38
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