Previous: , Up: Loading   [Contents][Index]

5.16.2 Autoloading

Obviously, not all features of the Librep environment are always used. Autoloading allows libraries to only be loaded when they are first required. This speeds up the initialisation process and may save memory.

Functions which may be autoloaded have a special form in their symbol’s function cell—an autoload form. This is a special kind of closure. When the function call dispatcher finds one of these forms it loads the program file specified in the form then re-evaluates the function call. The true function definition will then have been loaded and therefore the call may proceed as normal.

Autoload stubs may be created through the autoload function.

Function: autoload symbol file #!optional is-command

Installs an autoload form into the symbol symbol. It marks that when symbol is called as a function the lisp library file should be loaded to provided the actual definition of symbol.

“Magic cookie” ;;;###autoload comment in the source is meaningless. It was supported by Obsolete “Jade” editor only.