What Are All These Class Files Even About? And Other Stories
summary
Clojure compiles almost everything to JVM bytecode even at the REPL, turning each top-level form into a zero-arg function class and each function literal into its own bespoke class. Loading mutates a mutable namespace graph (namespaces, mappings, VARs) and the compiler writes function classes plus one init class per file whose static initializer reproduces all top-level side effects. A small two-namespace example produces 7 class files (four for one ns, three for the other), and those init classes let the compiled code run correctly in another JVM.
AI-written summary · about
chapters (11)
- 0:00Start
- 2:21The Dynamic Runtime
- 2:48Namespace Enclosure
- 3:38Aliases Map
- 6:50Loading Context
- 11:37Entry Points for Loading Code in Closure
- 19:28Compiler
- 20:56Multiple Functions in a Single Expression
- 23:31Ahead of Time Compilation
- 28:23Static Initialization
- 30:26Summary
related talks
30mHow Clojure Works: Understanding the Clojure Runtime
43mDeep Dive into the .class File and Even Deeper
32mClojure, Java 9, and You
01h 04mClojure Compilation, Backwards
39mA Journey - On Tour with Java Code on It’s Way Through the JVM
45mDeep Dive into the .class File and the Class Loader
32mUnveiling the Hidden Layers of Java Class Files Beyond Bytecode
36mFrom Scala to ByteCode...
