Fork me on GitHub
#clojure
<
2023-10-22
>
jasonjckn03:10:07

If you enable direct linking for your Clojure application, will it only affect the code in your project ? Dependencies you pull in from other libraries or projects will still use their own compilation options, is that basically all there is to know for dependencies? So alter-var-root on a dependency var is hit/miss ?

hiredman03:10:29

Compilation is transitive, and code is compiled with whatever options are set when they are compiled

👍 1
hiredman03:10:00

Sometimes people distribute libraries that are aot compiled, but that usually ends in tears (clojure's compilation model is just not well suited to it, it is very easy to run into problems)

👍 1
reefersleep11:10:21

Could you expand on those tears, @U0NCTKEV8 ? 🙏 :face_with_monocle:

hiredman11:10:03

Because compilation is transitive when you aot your library you will also get your libraries dependencies aot compiled

hiredman11:10:35

So naively you can end up packaging more than your library

hiredman11:10:01

You can go and delete the "extra" class files, but clojure compilation is non-determinisric (if a few different ways) so the outputs can and up tied to the exact compilation environment that produced them

hiredman11:10:49

And it can be challenging as a consumer of the library to produce the exact same compilation environment when you are compiling your code

hiredman11:10:31

https://clojure.atlassian.net/browse/CLJ-1544 is an example of the annoying problems you get to deal with if you use libraries that are aot compiled

hiredman11:10:51

Oh, right, then eval with aot compilation https://clojure.atlassian.net/browse/CLJ-1916

phill11:10:59

Also, it seems to me there's been some discussion on this august Forum about malfunctions related to combining multiple versions of Clojure through AOT compilation.