diff --git a/doc/ref/scheme-modules.texi b/doc/ref/scheme-modules.texi index d15d8c23f..012238d74 100644 --- a/doc/ref/scheme-modules.texi +++ b/doc/ref/scheme-modules.texi @@ -254,6 +254,32 @@ close-pipe unixy:close-pipe This example also shows how to use the convenience procedure @code{symbol-prefix-proc}. +You can also directly refer to bindings in a module by using the +@code{@@} syntax. For example, instead of using the +@code{use-modules} statement from above and writing +@code{unixy:pipe-open} to refer to the @code{pipe-open} from the +@code{(ice-9 popen)}, you could also write @code{(@@ (ice-9 popen) +open-pipe)}. Thus an alternative to the complete @code{use-modules} +statement would be + +@smalllisp +(define unixy:pipe-open (@@ (ice-9 popen) open-pipe)) +(define unixy:close-pipe (@@ (ice-9 popen) close-pipe)) +@end smalllisp + +There is also @code{@@@@}, which can be used like @code{@@}, but does +not check whether the variable that is being accessed is actually +exported. Thus, @code{@@@@} can be thought of as the impolite version +of @code{@@} and should only be used as a last resort or for +debugging, for example. + +Note that just as with a @code{use-modules} statement, any module that +has not yet been loaded yet will be loaded when referenced by a +@code{@@} or @code{@@@@} form. + +You can also use the @code{@@} and @code{@@@@} syntaxes as the target +of a @code{set!} when the binding refers to a variable. + @c begin (scm-doc-string "boot-9.scm" "symbol-prefix-proc") @deffn {Scheme Procedure} symbol-prefix-proc prefix-sym Return a procedure that prefixes its arg (a symbol) with @@ -302,6 +328,17 @@ transformer as the system transformer for the currently defined module, as well as installing it as the current system transformer. @end deffn +@deffn syntax @@ module-name binding-name +Refer to the binding named @var{binding-name} in module +@var{module-name}. The binding must have been exported by the module. +@end deffn + +@deffn syntax @@@@ module-name binding-name +Refer to the binding named @var{binding-name} in module +@var{module-name}. The binding must not have been exported by the +module. This syntax is only intended for debugging purposes or as a +last resort. +@end deffn @node Creating Guile Modules @subsection Creating Guile Modules diff --git a/doc/ref/scripts.texi b/doc/ref/scripts.texi index 10549dc12..e0c5f2345 100644 --- a/doc/ref/scripts.texi +++ b/doc/ref/scripts.texi @@ -60,6 +60,11 @@ always invokes the @var{function} as the @emph{last} action it performs. This is weird, but because of the way script invocation works under POSIX, the @code{-s} option must always come last in the list. +The @var{function} is most often a simple symbol that names a function +that is defined in the script. It can also be of the form @code{(@@ +@var{module-name} @var{symbol}} and in that case, the symbol is +looked up in the module named @var{module-name}. + @xref{Scripting Examples}. @item -ds