cloojure/tupelo

MapEntry in ClojureScript requires a third argument "__hash"

w9 opened this issue · 3 comments

w9 commented

:cljs (cljs.core.MapEntry. key val)))

See https://cljs.github.io/api/cljs.core/MapEntry

Currently, the missing third argument gives a warning when compiled:

------ WARNING #1 - :fn-arity --------------------------------------------------
 Resource: tupelo/core.cljc:1200:12
 Wrong number of args (2) passed to cljs.core.MapEntry
--------------------------------------------------------------------------------

Hmmm,

Looks like we could fix with this as the 3rd arg:

(hash-ordered-coll [key val])

???

Since __hash is mutable and filled in later, nil might work better as the 3rd arg.

https://github.com/clojure/clojurescript/blob/r1.10.891-1-g64435188/src/main/cljs/cljs/core.cljs#L2388

Or even (first {k v}) might be a portable solution.