This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
@quoll I found a https://blog.wsscode.com/guide-to-custom-map-types/ on custom map types, and he recommends using the https://github.com/clj-commons/potemkin library’s
def-map-type macro for bootstrapping a correct map implementation in Clojure. How do you feel about adding a dependency like this? From what I’m gathering, implementing a correct custom map type in Clojure is actually quite involved, and so a tool to alleviate that pain might be useful. The macro is unfortunately clojure-only (no cljs), but Wilker links to Mike Fike’s https://github.com/mfikes/cljs-bean/blob/348c8296ccd6f592ba46a8ddea989cb7aa2da2e8/src/cljs_bean/core.cljs#L225-L363 for inspiration on that side (it appears much easier to implement manually).
I’m still gathering information at this stage, so wanted to touch base with you.
The Cljs requirements is important. I know there are lots of functions to implement, and they differ between Clojure and ClojureScript, since ClojureScript uses protocols instead of interfaces, but it's just a matter of being thorough. I did actually start on it yesterday, though I got pulled out for a meeting that was nearly 3 hours long, so I'm still only partway in.
Yea I felt the same way, which prompted me to reach out before getting any code written. I’m also not too keen on complex macros… That’s really great news that you started on it! Hopefully the links I shared can help out a bit. Worst case scenario Potemkin’s macro can at least serve as a guide.
Something else to consider about Potemkin is its compatibility with GraalVM, which I know asami makes use of for its cli. I see that is uses things like https://github.com/clj-commons/potemkin/blob/3e404364ae2fd32f7a53b362a79d2012ab958ab2/src/potemkin/collections.clj#L116 and https://github.com/clj-commons/potemkin/blob/3e404364ae2fd32f7a53b362a79d2012ab958ab2/src/potemkin/collections.clj#L28, which might be incompatible with graal? I’m very unfamiliar with graal, but I’ve heard whispers of those very dynamic features causing troubles.