views:

52

answers:

1

For C/C++, people use #ifdef .. #endif technique to prevent reloading libraries, and Objective-C uses import to do the same thing.

How about lisp/elisp? If (require 'cl) is used before, and (require 'cl) is seen somewhere, lisp is clever enough not to load it again? Or, is there any way to prevent this reloading libraries?

+4  A: 

No, elisp won't load it again. From the docs (C-h f require):

"If feature FEATURE is not loaded, load it from FILENAME."

The same is true for Common Lisp:

"The require function tests whether a module is already present (using a case-sensitive comparison); if the module is not present, require proceeds to load the appropriate file or set of files."

Matthew Flaschen