squint

borkdude 2025-10-18T09:47:56.382179Z

Haha, so cool. With object inference,

(-> (assoc! {} :a :b) (assoc! :c :d) (assoc! :e :f))
now becomes:
(o=>(o.e="f",o))((o=>(o.c="d",o))((o=>(o.a="b",o))({})))
after minified with esbuild

😲 3
borkdude 2025-10-18T10:41:06.864929Z

Since (:foo ...) compiles to get and destructuring also compiles to get calls, this is automatically optimized too. I hadn't even realized that.

(let [x {:a 1 :b 2 :c 2}
      {:keys [a b c]} x]
  [a b c])
const x2 = { a: 1, b: 2, c: 2 };
  const map__13 = x2;
  const a4 = map__13["a"];
  const b5 = map__13["b"];
  const c6 = map__13["c"];
  [a4, b5, c6];

🤌 5