-
Notifications
You must be signed in to change notification settings - Fork 179
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
Fix instrumentation of small map literals. Minor doc updates. #665
Fix instrumentation of small map literals. Minor doc updates. #665
Conversation
Map literal instrumentation was relying on some heuristic before. We use Clojures underlying array-map implementation for small map literals and fall back to a sorted order of keys if that is not the case. If this fails as well we simply instrument only the values of the map in the order they appear in a sequential pass.
I haven't yet added any tests as I want to get your feedback first. |
;; has specified them in that order. If that fails we fall | ||
;; back to simply instrumenting the values in the order they | ||
;; they appear in the map. | ||
;; This depends on Clojure implementation details. |
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.
More than happy to consider other heuristics or if you think this is a bad idea.
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.
The idea is reasonable, although this is something we should probably mention in some "Caveats" section of the debugger, so users are not surprised by the behaviour in different scenarios.
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 changed the policy once more. I think the best thing is to do nothing if the ordered keys approach fails. I will also start a caveats section in the cider docs.
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 like the updated approach.
Thanks! |
Map literal instrumentation was relying on some heuristic before.
We use Clojures underlying array-map implementation for small map
literals and fall back to a sorted order of keys if that is not the
case. If this fails as well we simply instrument only the values of
the map in the order they appear in a sequential pass.
This fixes clojure-emacs/cider#2773 for small maps at least.
Before submitting a PR make sure the following things have been done: