Skip to content

Conversation

@iarenaza
Copy link
Contributor

CIDER doesn't adhere to Bencode spec which requires dictionary keys to be sorted alphabetically. This hasn't been a problem so far because the bencode reader on nREPL side doesn't validate the order of keys. Still, it will be rigorous to produce correct values according to the selected format.

[Re: #3786]

Replace this placeholder text with a summary of the changes in your PR.
The more detailed you are, the better.


Before submitting the PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):

  • The commits are consistent with our contribution guidelines
  • You've added tests (if possible) to cover your change(s)
  • All tests are passing (eldev test)
  • All code passes the linter (eldev lint) which is based on elisp-lint and includes
  • You've updated the changelog (if adding/changing user-visible functionality)
  • You've updated the user manual (if adding/changing user-visible functionality)

Thanks!

If you're just starting out to hack on CIDER you might find this section of its
manual
extremely useful.

nrepl-client.el Outdated
(cons string-q response-q))))

(defun nrepl--bencode-dict (dict)
"Encode DICT with bencode."
Copy link
Member

Choose a reason for hiding this comment

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

Probably we should mention in the docstring that the keys need to be sorted as per the spec, as this is probably not obvious to people not familiar with bencode - until recently even I didn't know this was in the spec. :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

CIDER doesn't adhere to Bencode spec which requires dictionary keys to
be sorted alphabetically. This hasn't been a problem so far because
the bencode reader on nREPL side doesn't validate the order of
keys. Still, it will be rigorous to produce correct values according
to the selected format.
@bbatsov bbatsov merged commit 8569592 into clojure-emacs:master Apr 23, 2025
5 of 9 checks passed
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