Create, configure, and expose Java objects from Clojure without letting object construction leak into the functional core; compare constructors, doto, proxy, reify, and gen-class at the boundary.
Sometimes you need a Java object: a client, a builder, a stream, a time type, a JDBC datasource. In idiomatic Clojure, you create and configure Java objects at the edges, then keep the core of your program working with plain data.
Two patterns show up a lot:
(java.util.ArrayList. 10) or (java.io.File. "x.txt")doto for “configure this object and return it”The aim is to keep object creation localized so it does not leak across your codebase as an implicit global dependency.