clojurescript

Marten Sytema 2025-07-18T14:11:38.769959Z

I found a bug in Clojurescript 1.12.38, note the var with a -, and the var with an _ If I destructure it differently, ie. {pid :product_uuid} it does work, also if you run the code below in a Clojure REPL it also works.

(defn f [product-uuid]
    (mapv (fn [{:keys [product_uuid] :as x}]
            (when (= product-uuid product_uuid)
              x))
          [{:product_uuid 1}]))

  (f 1) ;; => [{:product_uuid 1}]

  ;; should be [nil]
  (f 2) ;; actually is => [{:product_uuid 1}]

Marten Sytema 2025-07-18T14:34:20.386489Z

(let [a-b 1
      a_b 2
      c-d 3
      c_d 4
      _ 5
      - 6]
  [a-b a_b c-d c_d _ -])
=> [2 2 4 4 6 6]

Marten Sytema 2025-07-18T14:41:36.741999Z

amazing

p-himik 2025-07-18T14:52:59.344999Z

It's a known thing.

1
gaverhae 2025-07-18T16:39:42.388569Z

FWIW I don't seem to have that issue with 1.12.42.

gaverhae 2025-07-18T16:44:31.903629Z

🤔

gaverhae 2025-07-18T16:45:34.964289Z

I'm very confused: I can reproduce the [2 2 4 4 6 6] result in a repl, but not when I put the same code in my source files.

2025-07-18T22:38:08.403839Z

This might be https://clojure.atlassian.net/browse/CLJS-3426 ?

Marten Sytema 2025-07-19T10:02:10.033459Z

yeah that’s the same,.. ok

Marten Sytema 2025-07-18T14:12:39.008779Z

This is probably the worst place to post this, but it was a confusing 30 minutes before I figured out what was going on :-)

Marten Sytema 2025-07-18T14:37:37.243339Z

tldr; _ = -