Next: Parsing command-line options, Previous: Package metainformation, Up: Library modules - Gauche extensions [Contents][Index]
gauche.parameter
- Parameters (extra)Parameters are now built-in, so you no longer need to use
this
module for basic parameter functionalities.
This module is provided mainly so that the existing code with
(use gauche.parameter)
won’t get an error.
It also provides a less-frequenlty used parameter observer interface.
{gauche.parameter} Adds proc to "observer" procedures of a parameter p. Observer procedures are called either (1) just before a new value is set to the parameter, or (2) just after the new value is set to the parameter. In case of (1), a filter procedure is already applied before a callback is called. In either case, observer procedures are called with two arguments, the old value and the new value. The return value(s) of observer procedures are discarded.
The optional when argument must be either a symbol before
or after
, to specify whether proc should be called
before or after the value is changed. If omitted, after
is
assumed.
The optional where argument must be either a symbol
append
or prepend
, to specify whether proc should
be prepended or appended to the existing observer procedure list.
If omitted, append
is assumed.
Note: Although the parameter value itself is thread-local, the observer list is shared by all threads.
{gauche.parameter}
Deletes proc from observer procedure list of a parameter p.
If proc is not in the list, nothing happens.
You can give either a symbol before
or after
to
when argument to specify from which list proc should be
deleted. If when argument is omitted, proc is deleted
from both lists.
{gauche.parameter} Returns a hook object (see Hooks) that keeps "before" or "after" observers, respectively.
Note: Although the parameter value itself is thread-local, these hook objects are shared by all threads.
Next: Parsing command-line options, Previous: Package metainformation, Up: Library modules - Gauche extensions [Contents][Index]