My surface level understanding is that GCL is a big reason why 3rd party libraries are a huge pain to use in Clojurescript.
Of course this would have went completely against the project’s goals, so it was never going to happen.
My surface level understanding is that GCL is a big reason why 3rd party libraries are a huge pain to use in Clojurescript.
Of course this would have went completely against the project’s goals, so it was never going to happen.
Shadow CLJS has made working with external libraries quite easy and IIRC it lets you set the compilation options for your libraries declaratively.
But can the compiler be used without the library? Or can the library be used without the compiler/would it still be beneficial?
For the most part, I would guess people still use the Closure Compiler because of its aggressive minification or for legacy reasons. I think both are probably true for ClojureScript, as well as the fact that the Compiler is Java-based so it has a Java API that (I am guessing here) made it easier to bootstrap on top of the JVM Clojure tooling / prior art.
There may be other reasons, but I assume the main reason that the Closure Compiler was chosen for ClojureScript was because it's Java based, so it was straightforward to get working. Moving away from it now would be a huge breaking change, so it's unlikely to happen in the official compiler anytime soon or ever. I think the only way it would actually happen is if an alternative like Cherry got enough traction and people moved to using mainly the alternative.
See: https://effectivetypescript.com/2023/09/27/closure-compiler/
> My surface level understanding is that GCL is a big reason why 3rd party libraries are a huge pain to use in Clojurescript.
I'm sure what "huge pain" your referring to, but I'm guessing it's dealing with name munging when externs aren't readily available. That comes from the compiler, not the library, and can be annoying. Mainly you have to make sure you reference things in ways that won't get mangled by the compiler (get x "foo") instead of (get x :foo). If you want to escape that you can always turn of advanced optimizations.
This isn't true.
What you might have heard is that the Google Closure Compiler with :advanced optimizations makes external libraries harder to use. This also isn't true if you use good tooling (shadow-cljs makes using npm libraries transparent and totally painless).
It is worth observing that :advanced optimizations result in a significant speed increase, but are considered too difficult to use in the JavaScript world. ClojureScript was designed from the start to be compiled in :advanced mode, so you get the benefits of an impressive whole-program optimizing compiler for free.