compile
(compile name &optional definition)
Coerces a literal (lambda ...) definition to a function, evaluated in the null lexical environment; a definition that is already a function is used as it is. With name nil, the function itself is returned; with a function name, the function is also installed as the global definition of that name and the name is returned, as in Common Lisp. Without a definition, the name's current definition stays and the name is returned: the name of a macro is accepted, and a name with no definition signals undefined-function. The second and third values, warnings-p and failure-p, are always nil. rontolisp's compile does not generate native code -- it exists so definition-time code construction idioms load: in particular, a no-argument definition whose body defines methods over class metaobjects (the (funcall (compile nil(lambda () ,code)))idiom of object mappers, wherecode` closes over values computed from the class) is executed as definition-time method construction.
In a compiled program (JVM / WASM output), that method-construction idiom is expanded at compile time and spliced into the program, and the run-time re-execution of the same call is a no-op. A definition that the program's own top-level definitions compile -- a library building a function from a lambda expression while it defines a class or a method, such as contextl's layered accessors -- is compiled ahead: the compiler runs those definitions when it compiles the program, and each definition they hand compile becomes compiled code in the program, with every object the definition holds (a generic function, a quoted list) taken from the run-time call. Any other run-time compile call evaluates the definition through the program's eval runtime, since a compiled program carries no compiler (see Compiled eval limitations). After (compile 'name definition) every reference to name sees the new definition, with a name computed at run time too, as after (setf fdefinition).