[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-11-244-g6

From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-11-244-g66ad445
Date: Fri, 06 Aug 2010 14:28:20 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

The branch, master has been updated
       via  66ad445dcfaa712a0f0b3f7d23c49b90165e1eaf (commit)
       via  e5f7f675d052a0ae34676cb040cc283688477b90 (commit)
       via  ba270f8c267f8886636939078a4c6f6b1f8107cd (commit)
       via  869bfe86af41ad92261128a1784bfb6638f78484 (commit)
       via  bc325e763f540048adc0e6375172af5cfc38742e (commit)
       via  ca290a89f3109f125f1eb6eeea066053d4b52e95 (commit)
       via  69724dde0aaa00e356502554c6bb587c1088563b (commit)
       via  935c7acac73667d0e3a9239f8a156f163baed6ce (commit)
      from  18e90860d12c7b54192046eb877153964808cc21 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 66ad445dcfaa712a0f0b3f7d23c49b90165e1eaf
Author: Andy Wingo <address@hidden>
Date:   Fri Aug 6 13:45:26 2010 +0200

    update NEWS for 1.9.12 (mostly)
    * NEWS: Update for 1.9.12.

commit e5f7f675d052a0ae34676cb040cc283688477b90
Author: Andy Wingo <address@hidden>
Date:   Fri Aug 6 13:43:47 2010 +0200

    add docs for extensiondir; misc other fixes
    * libguile/foreign.c (scm_i_pointer_print): Print in hexadecimal.
    * doc/ref/api-foreign.texi (Modules and Extensions): Update for
      "extensiondir", and a discussion of Guile versions.
      (Foreign Variables): Fix discussion of types.
      (Void Pointers and Byte Access): Fix typo.

commit ba270f8c267f8886636939078a4c6f6b1f8107cd
Author: Andy Wingo <address@hidden>
Date:   Fri Aug 6 13:41:58 2010 +0200

    remove type discusison from dynamic-pointer docstring
    * doc/ref/api-foreign.texi:
    * libguile/dynl.c (scm_dynamic_pointer): Remove discussion of types from
      the docstring.

commit 869bfe86af41ad92261128a1784bfb6638f78484
Author: Andy Wingo <address@hidden>
Date:   Fri Aug 6 13:15:58 2010 +0200

    * libguile/ (libpath.h): Change "extensionsdir" to
    * meta/ (extensiondir): Likewise.

commit bc325e763f540048adc0e6375172af5cfc38742e
Author: Andy Wingo <address@hidden>
Date:   Fri Aug 6 13:15:29 2010 +0200

    %site-dir is specific to the effective version
    * libguile/load.h:
    * libguile/load.c (scm_sys_global_site_dir): New API, is what %site-dir
      used to be.
      (scm_sys_site_dir): Changed to be a version-specific dir.
      (scm_init_load_path): Search the version-specific sitedir before the
      global one.
    * libguile/ (libpath.h): Update SCM_SITE_DIR and
      SCM_GLOBAL_SITE_DIR, as appropriate.

commit ca290a89f3109f125f1eb6eeea066053d4b52e95
Author: Andy Wingo <address@hidden>
Date:   Fri Aug 6 12:27:11 2010 +0200

    only one Value History section
    * doc/ref/repl-modules.texi: Remove section on Value History, it's
      covered in scheme-using.
    * doc/ref/scheme-using.texi: Rename "Value Historyx" section to "Value
    * doc/ref/guile.texi: Update xref.

commit 69724dde0aaa00e356502554c6bb587c1088563b
Author: Andy Wingo <address@hidden>
Date:   Fri Aug 6 12:16:49 2010 +0200

    add settable identifier syntax docs
    * doc/ref/api-macros.texi (Identifier Macros): Add documentation for
      settable identifier syntax.

commit 935c7acac73667d0e3a9239f8a156f163baed6ce
Author: Andy Wingo <address@hidden>
Date:   Fri Aug 6 11:52:27 2010 +0200

    letrec* in docs, and some r6rs fixes
    * doc/ref/api-binding.texi: Add docs for letrec*, and revise some other
    * doc/ref/compiler.texi: Update <letrec> for in-order?.
    * doc/ref/r6rs.texi: Add letrec* entry.
    * module/rnrs.scm:
    * module/rnrs/base.scm: Export letrec*.


Summary of changes:
 NEWS                      |  342 ++++++++++++++++++++++++++++++++++++++++++++-
 doc/ref/api-binding.texi  |  151 +++++++++++---------
 doc/ref/api-foreign.texi  |   65 ++++-----
 doc/ref/api-macros.texi   |   66 ++++++++-
 doc/ref/compiler.texi     |    6 +-
 doc/ref/guile.texi        |    1 -
 doc/ref/r6rs.texi         |    1 +
 doc/ref/repl-modules.texi |   34 +-----
 doc/ref/scheme-using.texi |    4 +-
 libguile/      |    5 +-
 libguile/dynl.c           |    5 -
 libguile/foreign.c        |    4 +-
 libguile/load.c           |   20 +++-
 libguile/load.h           |    3 +-
 meta/      |    2 +-
 module/rnrs.scm           |    2 +-
 module/rnrs/base.scm      |    2 +-
 17 files changed, 545 insertions(+), 168 deletions(-)

diff --git a/NEWS b/NEWS
index a908379..c40147f 100644
--- a/NEWS
+++ b/NEWS
@@ -4,17 +4,345 @@ See the end for copying conditions.
 Please send Guile bug reports to address@hidden
+  * ,x of failing computation
+  * (quit)
 (During the 1.9 series, we will keep an incremental NEWS for the latest
 prerelease, and a full NEWS corresponding to 1.8 -> 2.0.)
 Changes in 1.9.12 (since the 1.9.11 prerelease):
+** Many R6RS bugfixes
+`(rnrs bytevectors)' and `(rnrs io ports)' now have version information,
+like the rest of the modules. The `(rnrs unicode)' module is now
+re-exported by `(rnrs)'. Top-level `import' forms may have more than one
+clause. Warnings about duplicate bindings have been fixed, along with
+some typos in the modules. There were a number of other bugfixes as well.
+For the current list of known R6RS incompatibilities, see "R6RS
+Incompatibilities" in the manual.
+** Documentation for standard R6RS libraries
+See "R6RS Standard Libraries" in the manual, for more details.
+** Support for `letrec*'
+Guile now supports letrec*, a form of letrec in which the identifiers
+are bound in order. See "Local Bindings" in the manual, for more
+** Internal definitions now expand to `letrec*'
+Following the R6RS, internal definitions now expand to letrec* instead
+of letrec. The following program is invalid for R5RS, but valid for
+    (define (foo)
+      (define bar 10)
+      (define baz (+ bar 20))
+      baz)
+    ;; R5RS and Guile <= 1.8:
+    (foo) => Unbound variable: bar
+    ;; R6RS and Guile >= 2.0:
+    (foo) => 30
+This change should not affect correct R5RS programs, or programs written
+in earlier Guile dialects.
+** Recursive debugging REPL on error
+When Guile sees an error, instead of dropping into a special debugging
+prompt, it will enter a recursive REPL in the dynamic context of the
+error. See "Error Handling" in the manual, for more information.
+A recursive REPL is the same as any other REPL, except that it
+has been augmented with debugging information, so that one can inspect
+the context of the error. The debugger has been integrated with the REPL
+via a set of debugging meta-commands.
+For example, one may access a backtrace with `,backtrace' (or
+`,bt'). See "Interactive Debugging" in the manual, for more
+** Readline tab completion for arguments
+When readline is enabled, tab completion works for arguments too, not
+just for the operator position.
+** Various REPL robustness fixes
+The REPL no longer enters the debugger when an error occurs at read-time
+and compile-time, or when executing meta-commands. Additionally, the
+REPL is more strict about the ports that it uses, saving the current
+input and output ports at startup and using those ports when entering
+recursive prompts. This allows debugging of an error within
+e.g. `call-with-input-port'.
+Finally, Ctrl-d can now be used to exit a recursive REPL, dropping the
+user back to the parent REPL.
+** Better procedure name and source location propagation
+There was a bug in 1.9.11 which would leave most procedures un-named;
+this and other previous deficiencies have been fixed.
+** New macro: `current-source-location'
+See FIXME in the manual, for more information.
+** module-filename field and accessor
+Modules now record the file in which they are defined. This field may be
+accessed with the new `module-filename' procedure.
+** call-with-error-handling / with-error-handling
+FIXME: document?
+** Deprecate the old scm-style-repl
+The following bindings from boot-9 are now found in `(ice-9
+scm-style-repl)': `scm-style-repl', `error-catching-loop',
+`error-catching-repl', `bad-throw', `scm-repl-silent'
+`assert-repl-silence', `repl-print-unspecified',
+`assert-repl-print-unspecified', `scm-repl-verbose',
+`assert-repl-verbosity', `scm-repl-prompt', `set-repl-prompt!', `repl',
+`default-pre-unwind-handler', `handle-system-error',
+The following bindings have been deprecated, with no replacement:
+The following bindings have been totally removed:
+Deprecated forwarding shims have been installed so that users that
+expect these bindings in the main namespace will still work, but receive
+a deprecation warning.
+** Miscellaneous other deprecations
+`apply-to-args', `has-suffix?', `scheme-file-suffix'
+`get-option', `for-next-option', `display-usage-report',
+`transform-usage-lambda', `collect', `set-batch-mode?!'
+** All core defmacros reimplemented hygienically
+All macros present in the default environment are now implemented with
+syntax-case. This should not have practical ramifications, beyond those
+listed below in "Lexical bindings introduced by hygienic macros may not
+be referenced by nonhygienic macros".
 ** Random generator state may be serialized to a datum
 `random-state->datum' will serialize a random state to a datum, which
-may be written out and read back in later.  That datum may be used to
-construct an equivalent random state by calling `datum->random-state'.
+may be written out, read back in later, and revivified using
+`datum->random-state'.  See "Random" in the manual, for more details.
+** New primitive: `tmpfile'.
+See "File System" in the manual.
+** Modules load within a known environment
+It takes a few procedure calls to define a module, and those procedure
+calls need to be in scope. Now we ensure that the current module when
+loading a module is one that has the needed bindings, instead of relying
+on chance.
+** Remove encoding of versions into the file system
+It used to be that, when loading a module, if the user specified a
+version, Guile would grovel about in the filesystem to find the
+module. This process was slow and not robust. This support has been
+removed:  modules are once more always loaded via `primitive-load-path'.
+Module versions in the filesystem may be added again in the future, in
+an extensible way. Contact address@hidden with patches.
+** Alex Shinn's pattern matcher for (ice-9 match).
+Guile's copy of Andrew K. Wright's `match' library has been replaced by
+a compatible hygienic implementation by Alex Shinn.
+Compared to Andrew K. Wright's `match', the new `match' lacks
+`match-define', `match:error-control', `match:set-error-control',
+`match:error', `match:set-error', and all structure-related procedures.
+** Better debugging for psyntax
+We now build psyntax-pp.go directly from psyntax.scm, which allows us to
+preserve the original source locations and variable names. Git users
+will also be please to note that psyntax-pp.scm is no longer
+automatically regenerated from a normal `make' invocation.
+Guile's build is visually quieter, due to the use of Automake 1.11's
+AM_SILENT_RULES. Build as `make V=1' to see all of the output.
+** Better REPL options interface
+The set of REPL options is now fixed and typechecked -- you can't
+mistakenly set an option that doesn't exist, or set an value with an
+incorrect type. The following options have been added: `prompt',
+`compile-options', and `value-history'.
+The new `repl-default-option-set!' procedure from `(system repl common)'
+can set default options for future REPLs. `repl-default-prompt-set!' is
+a convenience procedure to set default prompts.
+** `*unspecified*' is identifier syntax
+`*unspecified*' is no longer a variable, so it is optimized properly by
+the compiler, and is not `set!'-able.
+** `set-batch-mode?!' replaced by `ensure-batch-mode!'
+"Batch mode" is a flag used to tell a program that it is not running
+interactively. One usually turns it on after a fork. It may not be
+turned off. `ensure-batch-mode!' deprecates the old `set-batch-mode?!',
+because it is a better interface, as it can only turn on batch mode, not
+turn it off.
+** `(debug)' gone (fix?)
+    * module/system/vm/debug.scm (debug): Change to debug the current stack
+      instead of the last stack.
+** Support for settable identifier syntax
+Following the R6RS, "variable transformers" are settable
+identifier-syntax. See "Identifier macros" in the manual, for more
+** Deprecate `save-stack', `the-last-stack'
+It used to be that the way to debug programs in Guile was to capture the
+stack at the time of error, drop back to the REPL, then debug that
+stack. But this approach didn't compose, was tricky to get right in the
+presence of threads, and was not very powerful.
+So `save-stack', `stack-saved?', and `the-last-stack' have been moved to
+`(ice-9 save-stack)', with deprecated bindings left in the root module.
+** Compilation warnings at the REPL
+By default, Guile now prints compile-time warnings for code entered at
+the REPL. Current warnings are for unbound variables and mismatched
+** syntax-case treats `_' as a placeholder
+Following R6RS, a `_' in a syntax-rules or syntax-case pattern matches
+anything, and binds no pattern variables. Unlike the R6RS, Guile also
+permits `_' to be in the literals list for a pattern.
+** Remove old Emacs interface
+Guile had an unused `--emacs' command line argument that was supposed to
+help when running Guile inside Emacs. This option has been removed, and
+the helper functions `named-module-use!' and `load-emacs-interface' have
+been deprecated.
+** `top-repl' has its own module
+The `top-repl' binding, called with Guile is run interactively, is now
+is its own module, `(ice-9 top-repl)'. A deprecated forwarding shim was
+left in the default environment.
+** Value history in the REPL on by default
+By default, the REPL will save computed values in variables like `$1',
+`$2', and the like. There are programmatic and interactive interfaces to
+control this. See "Value History" in the manual, for more information.
+** New threads are in `(guile-user)' by default, not `(guile)'
+It used to be that a new thread entering Guile would do so in the
+`(guile)' module, unless this was the first time Guile was initialized,
+in which case it was `(guile-user)'. This has been fixed to have all
+new threads unknown to Guile default to `(guile-user)'.
+** Backtrace improvements
+It used to be that backtraces showed a couple of extra frames, from the
+implementation of prompts. This has been fixed. Also, backtraces now
+print column numbers in addition to line numbers, if possible.
+** `display-error' takes a frame
+The `display-error' / `scm_display_error' helper now takes a frame as an
+argument instead of a stack. Stacks are still supported in deprecated
+builds. Additionally, `display-error' will again source location
+information for the error.
+** Better error reporting from the VM
+If a value of the wrong type is passed to `car', `cdr', `set-car!',
+`set-cdr!', `apply', a struct accessor, or a bytevector accessors, the
+error from the VM now indicates which procedure failed, instead of
+lumping them all into the non-helpful "VM error". In addition, unbound
+variable reporting is now more helpful.
+** No more `(ice-9 debug)'
+This module had some debugging helpers that are no longer applicable to
+the current debugging model. Importing this module will produce a
+deprecation warning. Users should contact bug-guile for support.
+** No more `(system vm debug)'
+This module is replaced by the recursive debugging REPL.
+** File ports handle binary mode and coding declarations
+Binary file ports are supported again, by opening files in the
+ISO-8859-1 encoding. If an encoding is not specified for textual ports,
+Guile now grovels the file for a "coding:" directive, and uses that if
+possible. See the documentation for `open-file', for more information.
+** R6RS character hex escapes on by default
+However, R6RS character escapes within strings are incompatible with
+older Guile escape sequences, so they still need the reader option
+turned on. See "Reader Options" in the manual, for more information.
+** Fix random number generator on 64-bit platforms
+There was a nasty bug on 64-bit platforms in which asking for a random
+integer with a range between 2**32 and 2**64 caused a segfault. After
+many embarrassing iterations, this was fixed.
+** Add `vhash-fold*' in `(ice-9 vlist)'.
+See "VLists" in the manual, for more information.
+** Timestamps on autocompiled files checked for freshness, not equality
+It used to be that to load a `.go' file instead of a `.scm' file, we
+required that the timestamp of the `.go' file be equal to that of the
+`.scm'. This has been relaxed to accept newer `.go' files, to integrate
+better with `make' tools.
+** Simplifications to the `(system foreign)' API.
+Guile's foreign function interface was simplified a great
+deal. Interested users should see the documentation for 
+** User Scheme code may be placed in a version-specific path
+Before, there was only one way to install user Scheme code to a
+version-specific Guile directory: install to Guile's own path,
+e.g. /usr/share/guile/2.0. The site directory,
+e.g. /usr/share/guile/site, was unversioned. This has been changed to
+add a version-specific site directory, e.g. /usr/share/guile/site/2.0,
+searched before the global site directory.
 ** And of course, the usual collection of bugfixes
@@ -36,6 +364,7 @@ Changes in 1.9.x (since the 1.8.x series):
 ** `(sxml match)', a pattern matcher for SXML
 ** `(srfi srfi-9 gnu)', extensions to the SRFI-9 record library
 ** `(system vm coverage)', a line-by-line code coverage library
 ** Imported statprof, SSAX, and texinfo modules from Guile-Lib
 The statprof statistical profiler, the SSAX XML toolkit, and the texinfo
@@ -722,9 +1051,10 @@ But this does not:
 It is not normal to run into this situation with existing code. However,
 as code is ported over from defmacros to syntax-case, it is possible to
-run into situations like this. In the future, Guile will probably port
-its `while' macro to syntax-case, which makes this issue one to know
+run into situations like this. For example, if you have a defmacro that
+generates a `while' expression, the `break' bound by the `while' may not
+be visible within other parts of your defmacro. The solution is to port
+from defmacros to syntax-rules or syntax-case.
 ** Macros may no longer be referenced as first-class values.
@@ -1351,7 +1681,7 @@ environments.
 Before, Guile only searched the system library paths for extensions
 (e.g. /usr/lib), which meant that the names of Guile extensions had to
 be globally unique. Installing them to a Guile-specific extensions
-directory is cleaner. Use `pkg-config --variable=extensionsdir
+directory is cleaner. Use `pkg-config --variable=extensiondir
 guile-2.0' to get the location of the extensions directory.
 ** New dependency: libgc
diff --git a/doc/ref/api-binding.texi b/doc/ref/api-binding.texi
index c5d5659..60af456 100644
--- a/doc/ref/api-binding.texi
+++ b/doc/ref/api-binding.texi
@@ -1,14 +1,12 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 @node Binding Constructs
 @section Definitions and Variable Bindings
address@hidden FIXME::martin: Review me!
 Scheme supports the definition of variables in different contexts.
 Variables can be defined at the top level, so that they are visible in
 the entire program, and variables can be defined locally to procedures
@@ -27,8 +25,7 @@ and expressions.  This is important for modularity and data 
 @cindex variable definition
-On the top level of a program (i.e. when not inside the body of a
-procedure definition or a @code{let}, @code{let*} or @code{letrec}
+At the top level of a program (i.e., not nested within any other
 expression), a definition of the form
@@ -38,10 +35,10 @@ expression), a definition of the form
 defines a variable called @code{a} and sets it to the value @var{value}.
-If the variable already exists, because it has already been created by a
-previous @code{define} expression with the same name, its value is
-simply changed to the new @var{value}.  In this case, then, the above
-form is completely equivalent to
+If the variable already exists in the current module, because it has
+already been created by a previous @code{define} expression with the
+same name, its value is simply changed to the new @var{value}.  In this
+case, then, the above form is completely equivalent to
 (set! a @var{value})
@@ -95,27 +92,23 @@ Attention: Scheme definitions inside local binding 
 @node Local Bindings
 @subsection Local Variable Bindings
address@hidden FIXME::martin: Review me!
 @cindex local bindings
 @cindex local variables
-As opposed to definitions at the top level, which are visible in the
-whole program (or current module, when Guile modules are used), it is
-also possible to define variables which are only visible in a
-well-defined part of the program.  Normally, this part of a program
-will be a procedure or a subexpression of a procedure.
+As opposed to definitions at the top level, which creates bindings that
+are visible to all code in a module, it is also possible to define
+variables which are only visible in a well-defined part of the program.
+Normally, this part of a program will be a procedure or a subexpression
+of a procedure.
-With the constructs for local binding (@code{let}, @code{let*} and
address@hidden), the Scheme language has a block structure like most
-other programming languages since the days of @sc{Algol 60}.  Readers
-familiar to languages like C or Java should already be used to this
-concept, but the family of @code{let} expressions has a few properties
-which are well worth knowing.
+With the constructs for local binding (@code{let}, @code{let*},
address@hidden, and @code{letrec*}), the Scheme language has a block
+structure like most other programming languages since the days of
address@hidden 60}.  Readers familiar to languages like C or Java should
+already be used to this concept, but the family of @code{let}
+expressions has a few properties which are well worth knowing.
-The first local binding construct is @code{let}.  The other constructs
address@hidden and @code{letrec} are specialized versions for usage where
-using plain @code{let} is a bit inconvenient.
+The most basic local binding construct is @code{let}.
 @deffn syntax let bindings body
 @var{bindings} has the form
@@ -143,15 +136,16 @@ The values of the @var{init} expressions are stored into 
the variables.
 The expressions in @var{body} are evaluated in order, and the value of
 the last expression is returned as the value of the @code{let}
-The storage for the @var{variables} is freed.
 @end itemize
 The @var{init} expressions are not allowed to refer to any of the
 @end deffn
+The other binding contructs are variations on the same theme: making new
+values, binding them to variables, and executing a body in that new,
+extended lexical context.
 @deffn syntax let* bindings body
 Similar to @code{let}, but the variable bindings are performed
 sequentially, that means that all @var{init} expression are allowed to
@@ -177,20 +171,45 @@ procedures created in the @var{init} expression can 
recursively refer to
 the defined variables.
-(letrec ((even?
-          (lambda (n)
-              (if (zero? n)
-                  #t
-                  (odd? (- n 1)))))
-         (odd?
-          (lambda (n)
-              (if (zero? n)
-                  #f
-                  (even? (- n 1))))))
+(letrec ((even? (lambda (n)
+                  (if (zero? n)
+                      #t
+                      (odd? (- n 1)))))
+         (odd? (lambda (n)
+                  (if (zero? n)
+                      #f
+                      (even? (- n 1))))))
   (even? 88))
 @end lisp
+Note that while the @var{init} expressions may refer to the new
+variables, they may not access their values.  For example, making the
address@hidden function above creates a closure (@pxref{About Closure})
+referencing the @code{odd?} variable.  But @code{odd?} can't be called
+until after execution has entered the body.
address@hidden deffn
address@hidden syntax letrec* bindings body
+Similar to @code{letrec}, except the @var{init} expressions are bound to
+their variables in order.
address@hidden thus relaxes the letrec restriction, in that later
address@hidden expressions may refer to the values of previously bound
+(letrec ((a 42)
+         (b (+ a 10)))
+  (* a b))
address@hidden ;; Error: unbound variable: a
+(letrec* ((a 42)
+          (b (+ a 10)))
+  (* a b))
address@hidden 2184
address@hidden lisp
 @end deffn
 There is also an alternative form of the @code{let} form, which is used
@@ -204,11 +223,11 @@ iteration (@pxref{while do, Iteration})
 @c FIXME::martin: Review me!
 A @code{define} form which appears inside the body of a @code{lambda},
address@hidden, @code{let*}, @code{letrec} or equivalent expression is
-called an @dfn{internal definition}.  An internal definition differs
-from a top level definition (@pxref{Top Level}), because the definition
-is only visible inside the complete body of the enclosing form.  Let us
-examine the following example.
address@hidden, @code{let*}, @code{letrec}, @code{letrec*} or equivalent
+expression is called an @dfn{internal definition}.  An internal
+definition differs from a top level definition (@pxref{Top Level}),
+because the definition is only visible inside the complete body of the
+enclosing form.  Let us examine the following example.
 (let ((frumble "froz"))
@@ -222,11 +241,11 @@ peach
 Here the enclosing form is a @code{let}, so the @code{define}s in the
 @code{let}-body are internal definitions.  Because the scope of the
 internal definitions is the @strong{complete} body of the
address@hidden, the @code{lambda}-expression which gets bound
-to the variable @code{banana} may refer to the variable @code{apple},
-even though it's definition appears lexically @emph{after} the definition
-of @code{banana}.  This is because a sequence of internal definition
-acts as if it were a @code{letrec} expression.
address@hidden, the @code{lambda}-expression which gets bound to
+the variable @code{banana} may refer to the variable @code{apple}, even
+though its definition appears lexically @emph{after} the definition of
address@hidden  This is because a sequence of internal definition acts
+as if it were a @code{letrec*} expression.
 (let ()
@@ -240,29 +259,36 @@ is equivalent to
 (let ()
-  (letrec ((a 1) (b 2))
+  (letrec* ((a 1) (b 2))
     (+ a b)))
 @end lisp
+Internal definitions are only allowed at the beginning of the body of an
+enclosing expression.  They may not be mixed with other expressions.
 Another noteworthy difference to top level definitions is that within
 one group of internal definitions all variable names must be distinct.
 That means where on the top level a second define for a given variable
 acts like a @code{set!}, an exception is thrown for internal definitions
 with duplicate bindings.
address@hidden FIXME::martin: The following is required by R5RS, but Guile does 
address@hidden   signal an error.  Document it anyway, saying that Guile is 
+As a historical note, it used to be that internal bindings were expanded
+in terms of @code{letrec}, not @code{letrec*}. This was the situation
+for the R5RS report and before. However with the R6RS, it was recognized
+that sequential definition was a more intuitive expansion, as in the
+following case:
address@hidden  Internal definitions are only allowed at the beginning of the 
body of an
address@hidden  enclosing expression.  They may not be mixed with other 
+(let ()
+  (define a 1)
+  (define b (+ a a))
+  (+ a b))
address@hidden lisp  
+Guile decided to follow the R6RS in this regard, and now expands
+internal definitions using @code{letrec*}.
address@hidden  @lisp
address@hidden  (let ()
address@hidden    (define a 1)
address@hidden    a
address@hidden    (define b 2)
address@hidden    b)
address@hidden  @end lisp
 @node Binding Reflection
 @subsection Querying variable bindings
@@ -275,11 +301,6 @@ top level environment.
 Return @code{#t} if @var{sym} is defined in the module @var{module} or
 the current module when @var{module} is not specified; otherwise return
-Up to Guile 1.8, the second optional argument had to be @dfn{lexical
-environment} as returned by @code{the-environment}, for example.  The
-behavior of this function remains unchanged when the second argument is
 @end deffn
diff --git a/doc/ref/api-foreign.texi b/doc/ref/api-foreign.texi
index 0fb06d7..d7ff689 100644
--- a/doc/ref/api-foreign.texi
+++ b/doc/ref/api-foreign.texi
@@ -356,10 +356,24 @@ To define C primitives within a specific module, the 
simplest way is:
 (load-extension "foobar-c-code" "foo_bar_init")
 @end example
address@hidden extensiondir
 When loaded with @code{(use-modules (foo bar))}, the
 @code{load-extension} call looks for the @file{} (etc)
-object file in the standard system locations, such as @file{/usr/lib}
-or @file{/usr/local/lib}.
+object file in Guile's @code{extensiondir}, which is usually a
+subdirectory of the @code{libdir}. For example, if your libdir is
address@hidden/usr/lib}, the @code{extensiondir} for the Guile address@hidden
+series will be @file{/usr/lib/guile/2.0/}.
+The extension path includes the major and minor version of Guile (the
+``effective version''), because Guile guarantees compatibility within a
+given effective version. This allows you to install different versions
+of the same extension for different versions of Guile.
+If the extension is not found in the @code{extensiondir}, Guile will
+also search the standard system locations, such as @file{/usr/lib} or
address@hidden/usr/local/lib}. It is preferable, however, to keep your extension
+out of the system library path, to prevent unintended interference with
+other dynamically-linked C libraries.
 If someone installs your module to a non-standard location then the
 object file won't be found.  You can address this by inserting the
@@ -377,7 +391,7 @@ can by substituted into a source file like @file{}
 (define-module (foo bar))
-(load-extension "XXlibdirXX/foobar-c-code" "foo_bar_init")
+(load-extension "XXextensiondirXX/foobar-c-code" "foo_bar_init")
 @end example
@@ -386,17 +400,17 @@ with the following in a @file{Makefile}, using 
-        sed 's|XXlibdirXX|$(libdir)|' < >foo.scm
+        sed 's|XXextensiondirXX|$(libdir)/guile/2.0|' < >foo.scm
 @end example
-The actual pattern @code{XXlibdirXX} is arbitrary, it's only something
+The actual pattern @code{XXextensiondirXX} is arbitrary, it's only something
 which doesn't otherwise occur.  If several modules need the value, it
 can be easier to create one @file{foo/config.scm} with a define of the
address@hidden location, and use that as required.
address@hidden location, and use that as required.
 (define-module (foo config))
-(define-public foo-config-libdir "XXlibdirXX"")
+(define-public foo-config-extensiondir "XXextensiondirXX"")
 @end example
 Such a file might have other locations too, for instance a data
@@ -404,11 +418,6 @@ directory for auxiliary files, or @code{localedir} if the 
module has
 its own @code{gettext} message catalogue
-When installing multiple C code objects, it can be convenient to put
-them in a subdirectory of @code{libdir}, thus giving for example
address@hidden/usr/lib/foo/}.  If the objects are only meant to be
-used through the module, then a subdirectory keeps them out of sight.
 It will be noted all of the above requires that the Scheme code to be
 found in @code{%load-path} (@pxref{Build Config}).  Presently it's
 left up to the system administrator or each user to augment that path
@@ -416,21 +425,6 @@ when installing Guile modules in non-default locations.  
But having
 reached the Scheme code, that code should take care of hitting any of
 its own private files etc.
-Presently there's no convention for having a Guile version number in
-module C code filenames or directories.  This is primarily because
-there's no established principles for two versions of Guile to be
-installed under the same prefix (eg. two both under @file{/usr}).
-Assuming upward compatibility is maintained then this should be
-unnecessary, and if compatibility is not maintained then it's highly
-likely a package will need to be revisited anyway.
-The present suggestion is that modules should assume when they're
-installed under a particular @code{prefix} that there's a single
-version of Guile there, and the @code{guile-config} at build time has
-the necessary information about it.  C code or Scheme code might adapt
-itself accordingly (allowing for features not available in an older
-version for instance).
 @node Foreign Pointers
 @subsection Foreign Pointers
@@ -505,8 +499,8 @@ The @code{void} type.  It can be used as the first argument 
 @node Foreign Variables
 @subsubsection Foreign Variables
-Given the types defined in the previous section, C pointers may be
-looked up dynamically using @code{dynamic-pointer}.
+Pointers to variables in the current address space may be looked up
+dynamically using @code{dynamic-pointer}.
 @deffn {Scheme Procedure} dynamic-pointer name dobj
 @deffnx {C Function} scm_dynamic_pointer (name, dobj)
@@ -514,11 +508,6 @@ Return a ``wrapped pointer'' for the symbol @var{name} in 
the shared
 object referred to by @var{dobj}.  The returned pointer points to a C
-This facility works by asking the dynamic linker for the address of a symbol,
-then assuming that it aliases a value of a given type. Obviously, the user must
-be very careful to ensure that the value actually is of the declared type, or
-bad things will happen.
 Regardless whether your C compiler prepends an underscore @samp{_} to the 
 names in a program, you should @strong{not} include this underscore in
 @var{name} since it will be added automatically when necessary.
@@ -532,9 +521,11 @@ pointing to that foreign value, we do:
 (use-modules (system foreign))
 (define numptob (dynamic-pointer "scm_numptob" (dynamic-link)))
address@hidden #<pointer 139984413364296>
address@hidden #<pointer 0x7fb35b1b4688>
 @end example
+(The next section discusses ways to dereference pointers.)
 A value returned by @code{dynamic-pointer} is a Scheme wrapper for a C
@@ -572,9 +563,7 @@ Wrapped pointers are untyped, so they are essentially 
equivalent to C
 pointer can be accessed at the byte level.  This is achieved using
 @emph{bytevectors} (@pxref{Bytevectors}).  The @code{(rnrs bytevector)}
 module contains procedures that can be used to convert byte sequences to
-Scheme objects such as strings, floating pointer numbers, or integers.
-Pointers may be accessed as bytevectors.
+Scheme objects such as strings, floating point numbers, or integers.
 @deffn {Scheme Procedure} pointer->bytevector pointer len [offset [uvec_type]]
 @deffnx {C Function} scm_foreign_to_bytevector pointer len offset uvec_type
diff --git a/doc/ref/api-macros.texi b/doc/ref/api-macros.texi
index 51f54ed..fba14f3 100644
--- a/doc/ref/api-macros.texi
+++ b/doc/ref/api-macros.texi
@@ -772,10 +772,68 @@ following to replace @code{fx+} with @code{+}:
 (define-syntax fx+ (identifier-syntax +))
 @end example
-Later versions of the @code{psyntax} @code{syntax-case} expander, on which
-Guile's syntax expander is based, include @code{identifier-syntax} support for
-recognizing identifiers on the left-hand side of a @code{set!} expression as
-well. Guile should port that code to its expander.
+There is also special support for recognizing identifiers on the
+left-hand side of a @code{set!} expression, as in the following:
+(define-syntax foo foo-transformer)
+(set! foo @var{val})
+;; expands via
+(foo-transformer #'(set! foo @var{val}))
+;; iff foo-transformer is a "variable transformer"
address@hidden example
+As the example notes, the transformer procedure must be explicitly
+marked as being a ``variable transformer'', as most macros aren't
+written to discriminate on the form in the operand position.
address@hidden {Scheme Procedure} make-variable-transformer transformer
+Mark the @var{transformer} procedure as being a ``variable
+transformer''. In practice this means that, when bound to a syntactic
+keyword, it may detect references to that keyword on the left-hand-side
+of a @code{set!}.
+(define bar 10)
+(define-syntax bar-alias
+  (make-variable-transformer
+   (lambda (x)
+     (syntax-case x (set!)
+       ((set! var val) #'(set! bar val))
+       ((var arg ...) #'(bar arg ...))
+       (var (identifier? #'var) #'bar)))))
+bar-alias @result{} 10
+(set! bar-alias 20)
+bar @result{} 20
+(set! bar 30)
+bar-alias @result{} 30
address@hidden example
address@hidden deffn
+There is an extension to identifer-syntax which allows it to handle the
address@hidden case as well:
address@hidden {Syntax} identifier-syntax (var exp1) ((set! var val) exp2)
+Create a variable transformer. The first clause is used for references
+to the variable in operator or operand position, and the second for
+appearances of the variable on the left-hand-side of an assignment.
+For example, the previous @code{bar-alias} example could be expressed
+more succinctly like this:
+(define-syntax bar-alias
+  (identifier-syntax
+    (var bar)
+    ((set! var val) (set! bar val))))
address@hidden example
+As before, the templates in @code{identifier-syntax} forms do not need
+wrapping in @code{#'} syntax forms.
address@hidden deffn
 @node Eval When
 @subsection Eval-when
diff --git a/doc/ref/compiler.texi b/doc/ref/compiler.texi
index 1883099..494a676 100644
--- a/doc/ref/compiler.texi
+++ b/doc/ref/compiler.texi
@@ -441,10 +441,10 @@ original binding names, @var{gensyms} are gensyms 
corresponding to the
 @var{names}, and @var{vals} are Tree-IL expressions for the values.
 @var{exp} is a single Tree-IL expression.
 @end deftp
address@hidden {Scheme Variable} <letrec> src names gensyms vals exp
address@hidden {External Representation} (letrec @var{names} @var{gensyms} 
@var{vals} @var{exp})
address@hidden {Scheme Variable} <letrec> in-order? src names gensyms vals exp
address@hidden {External Representation} (letrec @var{in-order?} @var{names} 
@var{gensyms} @var{vals} @var{exp})
 A version of @code{<let>} that creates recursive bindings, like
-Scheme's @code{letrec}.
+Scheme's @code{letrec}, or @code{letrec*} if @var{in-order?} is true.
 @end deftp
 @deftp {Scheme Variable} <dynlet> fluids vals body
 @deftpx {External Representation} (dynlet @var{fluids} @var{vals} @var{body})
diff --git a/doc/ref/guile.texi b/doc/ref/guile.texi
index 29b6570..3536104 100644
--- a/doc/ref/guile.texi
+++ b/doc/ref/guile.texi
@@ -352,7 +352,6 @@ available through both Scheme and C interfaces.
 * SRFI Support::                Support for various SRFIs.
 * R6RS Support::                Modules defined by the R6RS.
 * Readline Support::            Module for using the readline library.
-* Value History::               Maintaining a value history in the REPL.
 * Pretty Printing::             Nicely formatting Scheme objects for output.
 * Formatted Output::            The @code{format} procedure.
 * File Tree Walk::              Traversing the file system.
diff --git a/doc/ref/r6rs.texi b/doc/ref/r6rs.texi
index e552159..6c5637e 100644
--- a/doc/ref/r6rs.texi
+++ b/doc/ref/r6rs.texi
@@ -233,6 +233,7 @@ grouped below by the existing manual sections to which they 
 @deffn {Scheme Syntax} let bindings body
 @deffnx {Scheme Syntax} let* bindings body
 @deffnx {Scheme Syntax} letrec bindings body
address@hidden {Scheme Syntax} letrec* bindings body
 @xref{Local Bindings}, for documentation.
 @end deffn
diff --git a/doc/ref/repl-modules.texi b/doc/ref/repl-modules.texi
index 385ba49..21f6520 100644
--- a/doc/ref/repl-modules.texi
+++ b/doc/ref/repl-modules.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
@@ -254,38 +254,6 @@ possibilities in @var{string-list}.  Matching is 
 @end defun
address@hidden Value History
address@hidden Value History
address@hidden FIXME::martin: Review me!
address@hidden value history
-Another module which makes command line usage more convenient is
address@hidden(ice-9 history)}.  This module will change the REPL so that each
-value which is evaluated and printed will be remembered under a name
-constructed from the dollar character (@code{$}) and the number of the
-evaluated expression.
-Consider an example session.
-guile> (use-modules (ice-9 history))
-guile> 1
-$1 = 1
-guile> (+ $1 $1)
-$2 = 2
-guile> (* $2 $2)
-$3 = 4
address@hidden example
-After loading the value history module @code{(ice-9 history)}, one
-(trivial) expression is evaluated.  The result is stored into the
-variable @code{$1}.  This fact is indicated by the output @code{$1 = },
-which is also caused by @code{(ice-9 history)}.  In the next line, this
-variable is used two times, to produce the value @code{$2}, which in
-turn is used in the calculation for @code{$3}.
 @c Local Variables:
 @c TeX-master: "guile.texi"
 @c End:
diff --git a/doc/ref/scheme-using.texi b/doc/ref/scheme-using.texi
index cf4e230..e07b148 100644
--- a/doc/ref/scheme-using.texi
+++ b/doc/ref/scheme-using.texi
@@ -36,7 +36,7 @@ support for languages other than Scheme.
 * Readline::                    
-* Value Historyx::              
+* Value History::              
 * REPL Commands::               
 * Error Handling::              
 * Interactive Debugging::       
@@ -63,7 +63,7 @@ starts up interactively, so anything in this file has the 
same effect
 as if you type it in by hand at the ``scheme@@(guile-user)>'' prompt.
address@hidden Value Historyx
address@hidden Value History
 @subsection Value History
 Just as Readline helps you to reuse a previous input line, @dfn{value
diff --git a/libguile/ b/libguile/
index 9836aa1..1dcf4c2 100644
--- a/libguile/
+++ b/libguile/
@@ -620,7 +620,8 @@ libpath.h: $(srcdir)/  
        @echo '/* generated by Makefile */' > libpath.tmp
        @echo '#define SCM_PKGDATA_DIR "$(pkgdatadir)"' >> libpath.tmp
        @echo '#define SCM_LIBRARY_DIR 
-       @echo '#define SCM_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp
+       @echo '#define SCM_SITE_DIR 
"$(pkgdatadir)/site/$(GUILE_EFFECTIVE_VERSION)"' >> libpath.tmp
+       @echo '#define SCM_GLOBAL_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp
        @echo '#define SCM_LIB_DIR "$(libdir)"' >> libpath.tmp
        @echo '#define SCM_EXTENSIONS_DIR 
"$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions"' >> libpath.tmp
        @echo '#define SCM_CCACHE_DIR 
"$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/ccache"' >> libpath.tmp
@@ -646,7 +647,7 @@ libpath.h: $(srcdir)/  
        @echo ' { "pkglibdir",     "$(pkglibdir)" }, \' >> libpath.tmp
        @echo ' { "pkgincludedir", "$(pkgincludedir)" }, \' \
                >> libpath.tmp
-       @echo ' { "extensionsdir", 
"$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions" }, \' >> libpath.tmp
+       @echo ' { "extensiondir", 
"$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions" }, \' >> libpath.tmp
        @echo ' { "guileversion", "@GUILE_VERSION@" }, \' >> libpath.tmp
        @echo ' { "libguileinterface", "@LIBGUILE_INTERFACE@" }, \' \
                >> libpath.tmp
diff --git a/libguile/dynl.c b/libguile/dynl.c
index 2b1d656..dd1e0d3 100644
--- a/libguile/dynl.c
+++ b/libguile/dynl.c
@@ -240,11 +240,6 @@ SCM_DEFINE (scm_dynamic_pointer, "dynamic-pointer", 2, 0, 
            "Return a ``wrapped pointer'' to the symbol @var{name}\n"
            "in the shared object referred to by @var{dobj}.  The returned\n"
            "pointer points to a C object.\n\n"
-            "This facility works by asking the dynamic linker for\n"
-            "the address of a symbol, then assuming that it aliases a\n"
-            "value of a given type. Obviously, the user must be very\n"
-            "careful to ensure that the value actually is of the\n"
-            "declared type, or bad things will happen.\n\n"
            "Regardless whether your C compiler prepends an underscore\n"
            "@samp{_} to the global names in a program, you should\n"
            "@strong{not} include this underscore in @var{name}\n"
diff --git a/libguile/foreign.c b/libguile/foreign.c
index 5d5c7b4..90607e8 100644
--- a/libguile/foreign.c
+++ b/libguile/foreign.c
@@ -304,8 +304,8 @@ SCM_DEFINE (scm_set_pointer_finalizer_x, 
"set-pointer-finalizer!", 2, 0, 0,
 scm_i_pointer_print (SCM pointer, SCM port, scm_print_state *pstate)
-  scm_puts ("#<pointer ", port);
-  scm_display (scm_pointer_address (pointer), port);
+  scm_puts ("#<pointer 0x", port);
+  scm_uintprint (scm_to_uintptr (scm_pointer_address (pointer)), 16, port);
   scm_putc ('>', port);
diff --git a/libguile/load.c b/libguile/load.c
index 05667af..7c06c9b 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -167,8 +167,9 @@ SCM_DEFINE (scm_sys_library_dir, "%library-dir", 0,0,0,
 #ifdef SCM_SITE_DIR
 SCM_DEFINE (scm_sys_site_dir, "%site-dir", 0,0,0,
-           "Return the directory where the Guile site files are installed.\n"
-           "E.g., may return \"/usr/share/guile/site\".")
+           "Return the directory where users should install Scheme code for 
+            "with this version of Guile.\n\n"
+           "E.g., may return \"/usr/share/guile/site/" SCM_EFFECTIVE_VERSION 
 #define FUNC_NAME s_scm_sys_site_dir
   return scm_from_locale_string (SCM_SITE_DIR);
@@ -176,6 +177,18 @@ SCM_DEFINE (scm_sys_site_dir, "%site-dir", 0,0,0,
 #undef FUNC_NAME
 #endif /* SCM_SITE_DIR */
+SCM_DEFINE (scm_sys_global_site_dir, "%global-site-dir", 0,0,0,
+            (),
+           "Return the directory where users should install Scheme code for 
+            "with all versions of Guile.\n\n"
+           "E.g., may return \"/usr/share/guile/site\".")
+#define FUNC_NAME s_scm_sys_global_site_dir
+  return scm_from_locale_string (SCM_GLOBAL_SITE_DIR);
+#undef FUNC_NAME
+#endif /* SCM_GLOBAL_SITE_DIR */
@@ -239,8 +252,9 @@ scm_init_load_path ()
   else if (env)
     path = scm_parse_path (scm_from_locale_string (env), path);
-    path = scm_list_3 (scm_from_locale_string (SCM_LIBRARY_DIR),
+    path = scm_list_4 (scm_from_locale_string (SCM_LIBRARY_DIR),
                        scm_from_locale_string (SCM_SITE_DIR),
+                       scm_from_locale_string (SCM_GLOBAL_SITE_DIR),
                        scm_from_locale_string (SCM_PKGDATA_DIR));
   env = getenv ("GUILE_SYSTEM_COMPILED_PATH");
diff --git a/libguile/load.h b/libguile/load.h
index 0bff53c..d1afefb 100644
--- a/libguile/load.h
+++ b/libguile/load.h
@@ -3,7 +3,7 @@
 #ifndef SCM_LOAD_H
 #define SCM_LOAD_H
-/* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008, 2009 Free Software 
Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008, 2009, 2010 Free 
Software Foundation, Inc.
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -32,6 +32,7 @@ SCM_API SCM scm_c_primitive_load (const char *filename);
 SCM_API SCM scm_sys_package_data_dir (void);
 SCM_API SCM scm_sys_library_dir (void);
 SCM_API SCM scm_sys_site_dir (void);
+SCM_API SCM scm_sys_global_site_dir (void);
 SCM_API SCM scm_search_path (SCM path, SCM filename, SCM rest);
 SCM_API SCM scm_sys_search_load_path (SCM filename);
 SCM_API SCM scm_primitive_load_path (SCM filename_and_exception_on_not_found);
diff --git a/meta/ b/meta/
index c83d821..1280756 100644
--- a/meta/
+++ b/meta/
@@ -8,7 +8,7 @@ address@hidden@/guile
 Name: GNU Guile
diff --git a/module/rnrs.scm b/module/rnrs.scm
index eb2ea85..1c07e40 100644
--- a/module/rnrs.scm
+++ b/module/rnrs.scm
@@ -52,7 +52,7 @@
          boolean? symbol? char? vector? null? pair? number? string? procedure?
          define define-syntax syntax-rules lambda let let* let-values
-         let*-values letrec begin quote lambda if set! cond case or and not
+         let*-values letrec letrec* begin quote lambda if set! cond case or 
and not
          eqv? equal? eq? + - * / max min abs numerator denominator gcd lcm 
          floor ceiling truncate round rationalize real-part imag-part 
          make-rectangular angle div mod div-and-mod div0 mod0 div0-and-mod0
diff --git a/module/rnrs/base.scm b/module/rnrs/base.scm
index 4358aa4..728afe4 100644
--- a/module/rnrs/base.scm
+++ b/module/rnrs/base.scm
@@ -21,7 +21,7 @@
   (export boolean? symbol? char? vector? null? pair? number? string? procedure?
          define define-syntax syntax-rules lambda let let* let-values 
-         let*-values letrec begin 
+         let*-values letrec letrec* begin 
          quote lambda if set! cond case 

GNU Guile

reply via email to

[Prev in Thread] Current Thread [Next in Thread]