make-load-form
(make-load-form object &optional environment)
The generic function the COMPILER consults when an object appears as a literal in code it is compiling. Its method returns a form that reconstructs the object, and that form replaces the object in the compiled program.
An object gets into code that way when a macro splices a live object into its own expansion — the standard reason a library needs this. CFFI does it in every defcfun whose argument or return type is a defcenum, and declares a method so the object survives compilation.
The compile path routes only a type some method specializes on. A type no method covers is dumped as it always was, by writing out its slots, so a program that defines no make-load-form method compiles exactly as before. The two-value form is honored: a method may return a creation form and an init form, and the init form runs against the freshly created object.
A direct call, or #'make-load-form taken as a value, works with or without a method: the standard methods answer every other object, as in CL. An instance with no method of its own signals don't know how to dump ..., and an object that is not an instance signals no-applicable-method.
The creation form is evaluated once per program run, not once per use, so a method whose form is expensive (parsing a foreign type, compiling a scanner) costs that work one time.
The method is what lets an object with a slot the compiler cannot write out — a hash table, a foreign pointer — reach a compiled program at all. Without one such a literal fails the compile with Cannot quote: ..., which is the signal that the type wants a method.
The interpreter never needs any of this — its literal IS the live object — so the method only changes what a compiled program does, and the two agree by construction.
Lite: an object reached only through a quoted ARRAY or a hash table inside a constant is not rebuilt (a quoted cons structure is). The creation form may not refer back to the object being created.