cljs-dev

Chris McCormick 2025-11-27T03:50:01.892039Z

Hope it's ok to ask this in here and I'm not doing anything daft. I put this code from the release announcement into tiny2.cljs:

(->> (map inc (range 10)) 
  (filter even?) 
  (partition 2) 
  (drop 1) 
  (mapcat identity) 
  into-array) 
And then I ran this:
./cljs -t browser -o tiny2.js -O advanced --compile-opts '{:lite-mode true :elide-to-string true}' -c tiny2
$ ls -alh tiny2.js 
-rw-rw-r-- 1 chrism chrism 99K Nov 27 03:43 tiny2.js
I can't seem to get a size reduction with those flags. The build is actually larger than without those flags. The cljs script does this and I have confirmed it's the right version of cljs that is running:
exec clj -Sdeps "{:paths [\"$CP\"] :deps {org.clojure/clojurescript {:mvn/version \"1.12.116\"}}}" -M -m cljs.main "${ARGS[@]}"

Chris McCormick 2025-11-27T03:57:49.086359Z

Wait. PEBCAK. There were other .cljs files in the folder. I'm getting a 32k build uncompressed, 7.5k gzipped.

dnolen 2025-11-27T12:31:28.402609Z

yeap, that sound about right

Chris McCormick 2025-11-27T12:33:45.215499Z

This is blowing my mind. 7.5k gzipped with approximately native datastructures is wild.

dnolen 2025-11-27T12:35:41.871969Z

yeah it's just important to understand as I said in the release notes these knobs help w/ small programs - 22k gzipped - 7k gzipped range - brotli is smaller

dnolen 2025-11-27T12:36:25.161179Z

but the cool bit is that it is full fidelity ClojureScript, we test everything against lite-mode

dnolen 2025-11-27T12:37:28.874369Z

(modulo bugs / edge cases since it's brand new)

Chris McCormick 2025-11-28T01:15:22.387319Z

Yep understood - it's experimental.

borkdude 2025-11-27T19:18:29.675609Z

when making a deftype, cljs emits this:

cljs.user.MyCounted.cljs$lang$ctorStr = "cljs.user/MyCounted";

cljs.user.MyCounted.cljs$lang$ctorPrWriter = (function (this__18465__auto__,writer__18466__auto__,opt__18467__auto__){
  return cljs.core._write.call(null,writer__18466__auto__,"cljs.user/MyCounted");
});
I see the second one in action when doing (pr-str MyCounted) but what activates the first one? When I do (str MyCounted) is see a function so that couldn't be it

borkdude 2025-11-27T19:23:06.536729Z

ah primarily in error messages I see

borkdude 2025-11-27T20:07:18.220149Z

@dnolen Found a bug with method values, they can't be in return position:

ClojureScript 1.12.116
cljs.user=> (def String js/String)
#'cljs.user/String
cljs.user=> String/.toUpperCase
#object[ret__7996__auto__]
cljs.user=> (str String/.toUpperCase)
"function (x, ...args) { return Reflect.apply(cljs.user.String.prototype.toUpperCase, x, args) }"
cljs.user=> (let [] String/.toUpperCase)
Execution error (SyntaxError) at (:1).
Unexpected token 'return'

borkdude 2025-11-28T08:11:51.559499Z

Do you mean the local? It was only used in CLJS so I moved it inside the reader conditional. Can revert

dnolen 2025-11-28T11:55:50.143189Z

unrelated changes make patches really hard to review

borkdude 2025-11-28T11:56:33.185049Z

ok, want me to revert? I shouldn't have scratched that itch

dnolen 2025-11-28T11:56:37.624839Z

yes

dnolen 2025-11-28T11:57:31.211949Z

thanks! sorry spent a bit of time trying to understand the connection.

borkdude 2025-11-28T11:58:43.258409Z

no problem! re-attached patch.

dnolen 2025-11-28T12:28:20.101579Z

merged

borkdude 2025-11-28T12:29:35.982299Z

excellent

borkdude 2025-11-27T20:11:06.056749Z

Can make a issue+patch tomorrow

borkdude 2025-11-27T22:16:34.670419Z

ok patch uploaded: https://clojure.atlassian.net/browse/CLJS-3466

dnolen 2025-11-28T03:31:45.355069Z

thanks, why the code change for the bootstrapped path?