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

Question: why so many ancestors difference betwence Clj map and a PotemkinMap? #63

Closed
piotr-yuxuan opened this issue Apr 10, 2021 · 1 comment

Comments

@piotr-yuxuan
Copy link

piotr-yuxuan commented Apr 10, 2021

Thank you very much for this amazing library. I wish I were as deeply knowledgeable of Clojure and I had fathomed it as deep as you!

See here for the full differences: https://github.com/piotr-yuxuan/closeable-map/blob/39eb776d8452386e9068562bcac3e41084f86ad5/README.md#technicalities.

Notably, there are:

 ;; Ancestors of Clojure map only but not a custom map.
 #{clojure.lang.AFn ; Concrete type, but see below for IFn.
   clojure.lang.APersistentMap
   clojure.lang.IEditableCollection
   clojure.lang.IKVReduce
   clojure.lang.IMapIterable
   java.io.Serializable}

 ;; Ancestors of some custom map only.
 #{clojure.lang.IType
   java.util.Iterator
   potemkin.collections.PotemkinMap
   potemkin.types.PotemkinType}
@KingMob
Copy link
Contributor

KingMob commented Oct 4, 2022

Well, the A* ancestors are abstract classes, and potemkin's map types don't use them (could be a reason, but it could also just be due to sheer age of the library).

IKVReduce and IMapIterable are enhancements that weren't added until 2015, so they were definitely invented after potemkin's def-map-type. I just tested, and reduce-kv works on a def-map-type, so I suspect these are just optimizations.

IEditableCollection is about transient generation. I tested, and it looks like it flat out doesn't work, but it's worth a PR if you want to try adding it!

@KingMob KingMob closed this as completed Oct 4, 2022
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

No branches or pull requests

2 participants