For Gauche 0.9.15Search (procedure/syntax/module):

Next: , Previous: , Up: Library modules - Gauche extensions   [Contents][Index]

9.24 gauche.parameter - Parameters (legacy)

Module: gauche.parameter

This module is only provided for the backward compatibility. We strongly discourage using this module.

Parameters are now built-in, so you no longer need to use this module for basic parameter functionalities. However, they have slightly different semantics from the legacy parameters Gauche had. The parameters provided in this module is backward compatible, so that you can run legacy code without changes.

When you use this module, those two identifiers are rebound to the backward-compatibility API.

make-parameter

This becomes an alias of make-legacy-parameter.

parameterize

This becomes an alias of parameterize/dynwind

See Parameters and dynamic states, for the details of the difference.

Legacy parameters also had a feature called observers, a callback procedure to be called when the parameter’s value is modified. You can add/delete observers by the following API.

Note that observers are only attachable to legacy parameters. We plan to remove it eventually, so new code shouldn’t use it.

Function: parameter-observer-add! p proc :optional when where

{gauche.parameter} Deprecated. 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.

Function: parameter-observer-delete! p proc :optional when

{gauche.parameter} Deprecated. 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.

Function: parameter-pre-observers p
Function: parameter-post-observers p

{gauche.parameter} Deprecated. Returns a hook object (see gauche.hook - 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: , Previous: , Up: Library modules - Gauche extensions   [Contents][Index]


For Gauche 0.9.15Search (procedure/syntax/module):