| www.delorie.com/gnu/docs/guile/guile_372.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Fluids are objects to store values in. They have a few properties which make them useful in certain situations: Fluids can have one value per dynamic root (see section 32.3 Dynamic Roots), so that changes to the value in a fluid are only visible in the same dynamic root. Since threads are executed in separate dynamic roots, fluids can be used for thread local storage (see section 32.4 Threads).
Fluids can be used to simulate dynamically scoped variables. These are
used in several (especially in older) dialects of lisp, such as in Emacs
Lisp, and they work a bit like global variables in that they can be
modified by the caller of a procedure, and the called procedure will see
the changes. With lexically scoped variables--which are normally used
in Scheme--this cannot happen. See the description of
with-fluids* below for details.
New fluids are created with make-fluid and fluid? is used
for testing whether an object is actually a fluid.
#t iff obj is a fluid; otherwise, return
#f.
The values stored in a fluid can be accessed with fluid-ref and
fluid-set!.
#f.
with-fluids* temporarily changes the values of one or more fluids,
so that the given procedure and each procedure called by it access the
given values. After the procedure returns, the old values are restored.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |