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)
./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
exec clj -Sdeps "{:paths [\"$CP\"] :deps {org.clojure/clojurescript {:mvn/version \"1.12.116\"}}}" -M -m cljs.main "${ARGS[@]}"Wait. PEBCAK. There were other .cljs files in the folder. I'm getting a 32k build uncompressed, 7.5k gzipped.
yeap, that sound about right
This is blowing my mind. 7.5k gzipped with approximately native datastructures is wild.
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
but the cool bit is that it is full fidelity ClojureScript, we test everything against lite-mode
(modulo bugs / edge cases since it's brand new)
Yep understood - it's experimental.
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 itah primarily in error messages I see
@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' Do you mean the local? It was only used in CLJS so I moved it inside the reader conditional. Can revert
unrelated changes make patches really hard to review
ok, want me to revert? I shouldn't have scratched that itch
yes
thanks! sorry spent a bit of time trying to understand the connection.
no problem! re-attached patch.
merged
excellent
Can make a issue+patch tomorrow
ok patch uploaded: https://clojure.atlassian.net/browse/CLJS-3466
thanks, why the code change for the bootstrapped path?