Welcome! Please see the About page for a little more info on how this works.

0 votes
in Compiler by

I mean, is the generated bytecode directly fed to the JVM, or a .class file is created and the bytecode is saved there? And also, if a file is generated, is it generated for every evaluated expression?

1 Answer

0 votes
by
edited by

In general, all Clojure code is compiled to bytecode in classes. If running from source, this is done dynamically and loaded using a custom classloader. Optionally you can compile code "ahead of time" and produce .class files on disk using the compile function.

Some simple top-level expressions evaluated at the repl are simply evaluated without compiling and loading classes.

by
It might not be clear what "dynamically" means in "this is done dynamically".
I think it's worth mentioning that bytecode is only stored in memory in this case and not saved to disk.
by
Thank you very much!
...