
Clojure Is Simple (2017) - tosh
https://medium.com/@swlkr/clojure-is-simple-9cd0b101460d
======
sansnomme
A very important caveat: Clojure compilation is not side-effect free. If you
are generating the JVM equivalent of a binary (excluding the assumption of
stuff like GraalVM) i.e. a überjar, you are going to have a bad day if your
code does stuff like edit configuration files, call a JSON API etc. The code
would run during the compilation stage. Something to take note of.

~~~
comma_at
That's false, building an uberjar has nothing to do wit that. If you're
packaging an application typically your -main needs to be AOT compiled, that's
why you put :gen-class in your ns declaration. That namespace will get AOT
compiled. This still doesn't pose any issues since you shouldn't be doing such
side effects in the toplevel. So

    
    
        (alter-config-file!)
    

is bad because that code will run during compilation, but in

    
    
        (defn -main [& args]
          (alter-config-file!)
          (app!))
    

it will run only after calling -main.

~~~
sansnomme
Evaluation != Compilation that outputs a binary. This is what happens when
language authors become overly obsessed with the elegance of SICP and
completely forget how to slay dragons, properly.

