[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.19 Modules
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 static
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.
6.19.1 General Information about Modules | Guile module basics. | |
6.19.2 Using Guile Modules | How to use existing modules. | |
6.19.3 Creating Guile Modules | How to package your code into modules. | |
6.19.4 Modules and the File System | Installing modules in the file system. | |
6.19.5 R6RS Version References | Using version numbers with modules. | |
6.19.6 R6RS Libraries | The library and import forms. | |
6.19.7 Variables | First-class variables. | |
6.19.8 Module System Reflection | First-class modules. | |
6.19.9 Accessing Modules from C | How to work with modules with C code. | |
6.19.10 provide and require | The SLIB feature mechanism. | |
6.19.11 Environments | R5RS top-level environments. |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 20, 2013 using texi2html 5.0.