1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 22:31:12 +02:00

Document #:prefix option in use-module clauses.

* doc/ref/api-modules.texi (Using Guile Modules): Document #:prefix
  option.
This commit is contained in:
Mark H Weaver 2014-09-20 04:42:49 -04:00
parent 8f230e3341
commit 0fce815b1b

View file

@ -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, 2007, 2008, 2009, 2010, 2011, 2012, 2013
@c Copyright (C) 1996, 1997, 2000-2004, 2007-2014
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -126,6 +126,16 @@ them to suit the current module's needs. For example:
#:renamer (symbol-prefix-proc 'unixy:)))
@end lisp
@noindent
or more simply:
@cindex prefix
@lisp
(use-modules ((ice-9 popen)
#:select ((open-pipe . pipe-open) close-pipe)
#:prefix unixy:))
@end lisp
Here, the interface specification is more complex than before, and the
result is that a custom interface with only two bindings is created and
subsequently accessed by the current module. The mapping of old to new
@ -184,21 +194,24 @@ whose public interface is found and used.
@cindex binding renamer
@lisp
(MODULE-NAME [#:select SELECTION] [#:renamer RENAMER])
(MODULE-NAME [#:select SELECTION]
[#:prefix PREFIX]
[#:renamer RENAMER])
@end lisp
in which case a custom interface is newly created and used.
@var{module-name} is a list of symbols, as above; @var{selection} is a
list of selection-specs; and @var{renamer} is a procedure that takes a
symbol and returns its new name. A selection-spec is either a symbol or
a pair of symbols @code{(ORIG . SEEN)}, where @var{orig} is the name in
the used module and @var{seen} is the name in the using module. Note
that @var{seen} is also passed through @var{renamer}.
list of selection-specs; @var{prefix} is a symbol that is prepended to
imported names; and @var{renamer} is a procedure that takes a symbol and
returns its new name. A selection-spec is either a symbol or a pair of
symbols @code{(ORIG . SEEN)}, where @var{orig} is the name in the used
module and @var{seen} is the name in the using module. Note that
@var{seen} is also modified by @var{prefix} and @var{renamer}.
The @code{#:select} and @code{#:renamer} clauses are optional. If both are
omitted, the returned interface has no bindings. If the @code{#:select}
clause is omitted, @var{renamer} operates on the used module's public
interface.
The @code{#:select}, @code{#:prefix}, and @code{#:renamer} clauses are
optional. If all are omitted, the returned interface has no bindings.
If the @code{#:select} clause is omitted, @var{prefix} and @var{renamer}
operate on the used module's public interface.
In addition to the above, @var{spec} can also include a @code{#:version}
clause, of the form: