When programs become large, naming conflicts can occur when a function or global variable defined in one file has the same name as a function or global variable in another file. Even just a similarity between function names can cause hard-to-find bugs, since a programmer might type the wrong function name.
The approach used to tackle this problem is called information encapsulation, which consists of packaging functional units into a given name space that is clearly separated from other name spaces.
The language features that allow this are usually called the module system because programs are broken up into modules that are compiled separately (or loaded separately in an interpreter).
Older languages, like C, have limited support for name space
manipulation and protection. In C a variable or function is public by
default, and can be made local to a module with the
keyword. But you cannot reference public variables and functions from
another module with different names.
More advanced module systems have become a common feature in recently designed languages: ML, Python, Perl, and Modula 3 all allow the renaming of objects from a foreign module, so they will not clutter the global name space.
In addition, Guile offers variables as first-class objects. They can be used for interacting with the module system.
|• General Information about Modules:||Guile module basics.|
|• Using Guile Modules:||How to use existing modules.|
|• Creating Guile Modules:||How to package your code into modules.|
|• Modules and the File System:||Installing modules in the file system.|
|• R6RS Version References:||Using version numbers with modules.|
|• R6RS Libraries:||The library and import forms.|
|• Variables:||First-class variables.|
|• Module System Reflection:||First-class modules.|
|• Accessing Modules from C:||How to work with modules with C code.|
|• provide and require:||The SLIB feature mechanism.|
|• Environments:||R5RS top-level environments.|