cljs-dev

f2wHTttf 2026-02-24T04:04:00.759969Z

anyone familiar with the https://oxc.rs/docs/contribute/minifier? Seems like it's aiming to be a Closure compiler alternative? if it becomes a thing, would it make sense to have a CLJS compiler that only emits ESMs (now that they're the standard) and let users specify an output type (e.g. vanilla JS like Cherry, Closure-ingestable JS like current CLJS, oxc-ingestable JS potentially)? Or if the only difference would be optimizer-specific annotations, just the same JS with different annotations?

2026-02-24T12:11:19.248079Z

i think #cherry is in that space

borkdude 2026-02-24T13:23:40.706719Z

> if it becomes a thing, would it make sense to have a CLJS compiler that only emits ESMs Note that ESM has limitations. E.g. you cannot change a var from another ES module so you have to introduce workarounds that probably hinder optimization (unless there is an agreed upon namespace system, e.g. goog modules, that support mutating vars from other places).

👍 1
borkdude 2026-02-24T13:24:10.444299Z

This hinders (set! foo/bar 3) and (binding [foo/*dude* 4]) to work properly

borkdude 2026-02-24T13:25:01.813329Z

In cherry/squint I've worked around this by introducing a special REPL mode but this format isn't optimisable by esbuild for example.

f2wHTttf 2026-02-24T17:59:35.394149Z

I assume the "support mutating vars from other places" workaround is to export getters and setters so another ESM can import them and use the setter to mutate the value

f2wHTttf 2026-02-24T18:00:05.280749Z

e.g.

f2wHTttf 2026-02-24T18:00:27.461729Z

borkdude 2026-02-24T18:02:40.570399Z

Yes sure but that's not how CLJS works normally / so far

👌 1
f2wHTttf 2026-02-24T18:04:22.089989Z

ack. I guess there's some precedence for these exported getters and setters at least since that seems to be how many of the "stores" in frontend frameworks operate

borkdude 2026-02-24T18:13:25.326759Z

I guess that's how I could implement binding in squint/cherry, to emit getters/setters for dynamic vars that can be used in binding

f2wHTttf 2026-02-24T18:14:39.512019Z

as a slight tangent, I wonder if atoms could sit on top of the WIP native JS signals

borkdude 2026-02-24T18:15:39.212019Z

You can just implement the IAtom protocol for those

borkdude 2026-02-24T18:15:48.802649Z

or whatever it's called in CLJS

f2wHTttf 2026-02-24T18:16:45.423229Z

ah like what reagent does with its RAtom

borkdude 2026-02-24T18:17:28.523839Z

yeah

f2wHTttf 2026-02-24T04:49:44.367079Z

https://swc.rs/docs/configuration/compilation#jsctransformoptimizer that seems to do more than unused import removal (a.k.a. tree shaking) but not much