1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 09:10:22 +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 -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual. @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 Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions. @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:))) #:renamer (symbol-prefix-proc 'unixy:)))
@end lisp @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 Here, the interface specification is more complex than before, and the
result is that a custom interface with only two bindings is created and 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 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 @cindex binding renamer
@lisp @lisp
(MODULE-NAME [#:select SELECTION] [#:renamer RENAMER]) (MODULE-NAME [#:select SELECTION]
[#:prefix PREFIX]
[#:renamer RENAMER])
@end lisp @end lisp
in which case a custom interface is newly created and used. 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 @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 list of selection-specs; @var{prefix} is a symbol that is prepended to
symbol and returns its new name. A selection-spec is either a symbol or imported names; and @var{renamer} is a procedure that takes a symbol and
a pair of symbols @code{(ORIG . SEEN)}, where @var{orig} is the name in returns its new name. A selection-spec is either a symbol or a pair of
the used module and @var{seen} is the name in the using module. Note symbols @code{(ORIG . SEEN)}, where @var{orig} is the name in the used
that @var{seen} is also passed through @var{renamer}. 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 The @code{#:select}, @code{#:prefix}, and @code{#:renamer} clauses are
omitted, the returned interface has no bindings. If the @code{#:select} optional. If all are omitted, the returned interface has no bindings.
clause is omitted, @var{renamer} operates on the used module's public If the @code{#:select} clause is omitted, @var{prefix} and @var{renamer}
interface. operate on the used module's public interface.
In addition to the above, @var{spec} can also include a @code{#:version} In addition to the above, @var{spec} can also include a @code{#:version}
clause, of the form: clause, of the form: