[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.16 gauche.reload - Reloading modules

Module: gauche.reload
In the development cycle, you often have to reload modules frequently. This module supports it.

Note that some part of semantics of the program depends on the order of loading modules, so reloading arbitrary modules may change the program behavior unexpectedly. This module is for developers who knows what they are doing.

Redefinition rules: Reloading a module resets all the binding in the module by default. Sometimes it is not desirable, however. For example, you might have a large list of objects that takes time to rebuild. You can specify rules for the reloading procedure to determine which binding to keep.

The rule is described in the following syntax.
 
  <module-rules> : (<module-rule> ...)
  <module-rule>  : (<module-pattern> <rule> ...)
  <module-pattern> : a symbol module name, or a symbol containing glob pattern
  <rule>         : procedure | symbol | regexp
                 | (and <rule> ...)
                 | (or  <rule> ...)
                 | (not <rule>)

<module-rules> is the global rule to determine per-module rules. <module-pattern> is either a symbol module name or a symbol that contains glob pattern (e.g. mylib.*). If <rule> is a procedure, it is used as a predicate and the bindings whose value satisfies the predicate are kept from redefinition. If <rule> is a symbol, the binding of the variable whose name is the symbol is kept. If <rule> is a regexp, the bindings of the variable whose name matches the regexp are kept.

Note that the mechanism to prevent redefinition is kind of ad-hoc hack and semantically unclean. It's just for your convenience. Take a look at the code if you want to know the exact behavior.

Function: reload module-name &optional rule ...
Reloads the specified module. You can optionally specify redefinition rules by rule ..., where each rule is the term <rule> defined above.

Function: reload-modified-modules &optional module-rules
Reloads module(s) that have been modified since they are loaded last time. If optional module-rules is given, it is used to determine the redefinition rules for reloaded modules. If module-rules is omitted, the current rules are used. The default of current rules is empty. You can set the current rules by module-reload-rules.

Function: module-reload-rules &optional module-rules
This is a parameter (See section 9.12 gauche.parameter - Parameters) that keeps the default module rules for reload-modified-modules. If called without arguments, returns the current module rules. If called with module-rules, sets the argument to the current module rules.

Function: reload-verbose &optional flag
This is a parameter to control verbosity of the reloading procedures. If called without arguments, returns the current verbosity flag. If called with flag, it is set to the current verbosity flag.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Ken Dickey on November, 28 2002 using texi2html