/[guile]/guile/guile-core/doc/ref/scheme-modules.texi
ViewVC logotype

Diff of /guile/guile-core/doc/ref/scheme-modules.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.5 by ossau, Sat Mar 16 13:35:23 2002 UTC revision 1.1.2.6 by ossau, Wed Mar 27 21:48:16 2002 UTC
# Line 32  designed languages: ML, Python, Perl, an Line 32  designed languages: ML, Python, Perl, an
32  clutter the global name space.  clutter the global name space.
33  @cindex name space - private  @cindex name space - private
34    
35    In addition, Guile offers variables as first-class objects.  They can
36    be used for interacting with the module system.
37    
38  @menu  @menu
39  * Scheme and modules::          How modules are handled in standard Scheme.  * Scheme and modules::          How modules are handled in standard Scheme.
40  * The Guile module system::     How Guile does it.  * The Guile module system::     How Guile does it.
41  * Dynamic Libraries::           Loading libraries of compiled code at run time.  * Dynamic Libraries::           Loading libraries of compiled code at run time.
42    * Variables::                   First-class variables.
43  @end menu  @end menu
44    
45    
# Line 624  the Guile contrib archive to make @file{ Line 628  the Guile contrib archive to make @file{
628    
629  XXX - document @code{load-extension}, @code{scm_register_extension}  XXX - document @code{load-extension}, @code{scm_register_extension}
630    
631    
632    @node Variables
633    @section Variables
634    @tpindex Variables
635    
636    Variables are objects with two fields.  They contain a value and they
637    can contain a symbol, which is the name of the variable.  A variable is
638    said to be bound if it does not contain the object denoting unbound
639    variables in the value slot.
640    
641    Variables do not have a read syntax, they have to be created by calling
642    one of the constructor procedures @code{make-variable} or
643    @code{make-undefined-variable} or retrieved by @code{builtin-variable}.
644    
645    First-class variables are especially useful for interacting with the
646    current module system (@pxref{The Guile module system}).
647    
648    @deffn {Scheme Procedure} builtin-variable name
649    @deffnx {C Function} scm_builtin_variable (name)
650    Return the built-in variable with the name @var{name}.
651    @var{name} must be a symbol (not a string).
652    Then use @code{variable-ref} to access its value.
653    @end deffn
654    
655    @deffn {Scheme Procedure} make-undefined-variable
656    @deffnx {C Function} scm_make_undefined_variable ()
657    Return a variable that is initially unbound.
658    @end deffn
659    
660    @deffn {Scheme Procedure} make-variable init
661    @deffnx {C Function} scm_make_variable (init)
662    Return a variable initialized to value @var{init}.
663    @end deffn
664    
665    @deffn {Scheme Procedure} variable-bound? var
666    @deffnx {C Function} scm_variable_bound_p (var)
667    Return @code{#t} iff @var{var} is bound to a value.
668    Throws an error if @var{var} is not a variable object.
669    @end deffn
670    
671    @deffn {Scheme Procedure} variable-ref var
672    @deffnx {C Function} scm_variable_ref (var)
673    Dereference @var{var} and return its value.
674    @var{var} must be a variable object; see @code{make-variable}
675    and @code{make-undefined-variable}.
676    @end deffn
677    
678    @deffn {Scheme Procedure} variable-set! var val
679    @deffnx {C Function} scm_variable_set_x (var, val)
680    Set the value of the variable @var{var} to @var{val}.
681    @var{var} must be a variable object, @var{val} can be any
682    value. Return an unspecified value.
683    @end deffn
684    
685    @deffn {Scheme Procedure} variable? obj
686    @deffnx {C Function} scm_variable_p (obj)
687    Return @code{#t} iff @var{obj} is a variable object, else
688    return @code{#f}.
689    @end deffn
690    
691    
692  @c Local Variables:  @c Local Variables:
693  @c TeX-master: "guile.texi"  @c TeX-master: "guile.texi"
694  @c End:  @c End:

Legend:
Removed from v.1.1.2.5  
changed lines
  Added in v.1.1.2.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26