diff options
author | Andy Wingo <wingo@pobox.com> | 2011-02-09 20:54:22 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-02-09 20:56:04 +0100 |
commit | c5f30c4cba204114008b8ddc8ecea5a081be69b7 (patch) | |
tree | 25280cc6b74707f3d3d353a713f762e0555293f8 /doc/ref/api-binding.texi | |
parent | 9970cf67080b48ec35680c70146500428b47bf3e (diff) | |
download | guile-c5f30c4cba204114008b8ddc8ecea5a081be69b7.tar.gz |
add define-once
* module/ice-9/boot-9.scm (define-once): New syntax.
* doc/ref/api-binding.texi (Top Level):
* NEWS: Add notes about define-once.
Diffstat (limited to 'doc/ref/api-binding.texi')
-rw-r--r-- | doc/ref/api-binding.texi | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/doc/ref/api-binding.texi b/doc/ref/api-binding.texi index 60af45680..c97ae7390 100644 --- a/doc/ref/api-binding.texi +++ b/doc/ref/api-binding.texi @@ -1,6 +1,6 @@ @c -*-texinfo-*- @c This is part of the GNU Guile Reference Manual. -@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 2010 +@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 2010, 2011 @c Free Software Foundation, Inc. @c See the file guile.texi for copying conditions. @@ -88,6 +88,23 @@ longer visible. Attention: Scheme definitions inside local binding constructs (@pxref{Local Bindings}) act differently (@pxref{Internal Definitions}). +Many people end up in a development style of adding and changing +definitions at runtime, building out their program without restarting +it. (You can do this using @code{reload-module}, the @code{reload} REPL +command, the @code{load} procedure, or even just pasting code into a +REPL.) If you are one of these people, you will find that sometimes you +there are some variables that you @emph{don't} want to redefine all the +time. For these, use @code{define-once}. + +@fnindex defvar +@deffn {Scheme Syntax} define-once name value +Create a top level variable named @var{name} with value @var{value}, but +only if @var{name} is not already bound in the current module. +@end deffn + +Old Lispers probably know @code{define-once} under its Lisp name, +@code{defvar}. + @node Local Bindings @subsection Local Variable Bindings |