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

Remove 'resolve' from ordered set #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

* Remove use of `resolve` in ordered-set. [#71](https://github.com/clj-commons/ordered/issues/71)

## 1.15.12 - 2024-05-13

* Fix NPE when hashing ordered-set that contain `nil`.
* Fix NPE when hashing ordered-set that contain `nil`. [#73](https://github.com/clj-commons/ordered/issues/73)

## 1.15.11 - 2023-03-26

Expand Down
9 changes: 1 addition & 8 deletions src/flatland/ordered/set.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@

(declare transient-ordered-set)

;; We could use compile-if technique here, but hoping to avoid
;; an AOT issue using this way instead.
(def hasheq-ordered-set
(or (resolve 'clojure.core/hash-unordered-coll)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually OK on the top level

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought there was a similar case as with the ordered map, a runtime require, but that's not true it seems

Copy link
Contributor

Choose a reason for hiding this comment

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

So there is no need for this PR and the bb PR seems good then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, glad to hear the bb PR is unblocked. I think this is a worthwhile change anyway, given that we no longer support the versions the workaround exists for, but I'll wait for some others to take a peek before merging.

(fn old-hasheq-ordered-set [^Seqable s]
(reduce + (map hash (.seq s))))))

(deftype OrderedSet [^clojure.lang.IPersistentMap k->i
^clojure.lang.IPersistentVector i->k]
IPersistentSet
Expand Down Expand Up @@ -66,7 +59,7 @@

IHashEq
(hasheq [this]
(hasheq-ordered-set this))
(hash-unordered-coll this))

Set
(iterator [this]
Expand Down