tupelo icon indicating copy to clipboard operation
tupelo copied to clipboard

MapEntry in ClojureScript requires a third argument "__hash"

Open w9 opened this issue 4 years ago • 3 comments

https://github.com/cloojure/tupelo/blob/63a34492bdb2d1f7a94050c653ee233ec1211380/src/cljc/tupelo/core.cljc#L1207

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
--------------------------------------------------------------------------------

w9 avatar Nov 10 '20 03:11 w9

Hmmm,

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

(hash-ordered-coll [key val])

???

cloojure avatar Nov 10 '20 07:11 cloojure

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

frenchy64 avatar Nov 18 '21 18:11 frenchy64

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

frenchy64 avatar Nov 19 '21 02:11 frenchy64