mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-30 08:50:23 +02:00
Fixup some module-related references.
This commit is contained in:
parent
0281752f6a
commit
c71375c94b
3 changed files with 24 additions and 22 deletions
|
@ -1,4 +1,4 @@
|
||||||
@c $Id: intro.texi,v 1.7 2001-05-06 01:49:56 ttn Exp $
|
@c $Id: intro.texi,v 1.8 2001-05-13 19:14:41 ttn Exp $
|
||||||
|
|
||||||
@page
|
@page
|
||||||
@node What is Guile?
|
@node What is Guile?
|
||||||
|
@ -695,18 +695,21 @@ Guile has support for dividing a program into @dfn{modules}. By using
|
||||||
modules, you can group related code together and manage the
|
modules, you can group related code together and manage the
|
||||||
composition of complete programs from largely independent parts.
|
composition of complete programs from largely independent parts.
|
||||||
|
|
||||||
(The module system is in flux, and will likely look very different in
|
(Although the module system implementation is in flux, feel free to use it
|
||||||
the future. Feel free to use the existing system anyway. Guile will
|
anyway. Guile will provide reasonable backwards compatability.)
|
||||||
provide reasonable backwards compatability.)
|
|
||||||
|
Details on the module system beyond this introductory material can be found in
|
||||||
|
@xref{Modules}.
|
||||||
|
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Using Guile Modules::
|
* Intro to Using Guile Modules::
|
||||||
* Writing New Modules::
|
* Intro to Writing New Modules::
|
||||||
* Modules and Extensions::
|
* Intro to Modules and Extensions::
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Using Guile Modules
|
@node Intro to Using Guile Modules
|
||||||
@subsection Using Existing Modules
|
@subsection Intro to Using Existing Modules
|
||||||
|
|
||||||
Guile comes with a lot of useful modules, for example for string
|
Guile comes with a lot of useful modules, for example for string
|
||||||
processing or command line parsing. Additionally, there exist many
|
processing or command line parsing. Additionally, there exist many
|
||||||
|
@ -747,11 +750,9 @@ one line at a time.
|
||||||
"drwxr-sr-x 2 mgrabmue mgrabmue 1024 Mar 29 19:57 CVS"
|
"drwxr-sr-x 2 mgrabmue mgrabmue 1024 Mar 29 19:57 CVS"
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
More details of module usage can be found in (REFFIXME).
|
|
||||||
|
|
||||||
|
@node Intro to Writing New Modules
|
||||||
@node Writing New Modules
|
@subsection Intro to Writing New Modules
|
||||||
@subsection Writing New Modules
|
|
||||||
|
|
||||||
Of course it is possible to write modules yourself. Using modules for
|
Of course it is possible to write modules yourself. Using modules for
|
||||||
structuring your programs makes them more readable and lets you
|
structuring your programs makes them more readable and lets you
|
||||||
|
@ -805,8 +806,8 @@ After exporting, other modules can access the exported items simply by
|
||||||
using @code{use-modules} to load the module @code{(foo bar)}.
|
using @code{use-modules} to load the module @code{(foo bar)}.
|
||||||
|
|
||||||
|
|
||||||
@node Modules and Extensions
|
@node Intro to Modules and Extensions
|
||||||
@subsection Modules and Extensions
|
@subsection Intro to Modules and Extensions
|
||||||
|
|
||||||
In addition to Scheme code you can also put new procedures and other
|
In addition to Scheme code you can also put new procedures and other
|
||||||
named features that are provided by an extension into a module.
|
named features that are provided by an extension into a module.
|
||||||
|
@ -829,6 +830,7 @@ write a Scheme file with this contents
|
||||||
The file should of course be saved in the right place for autoloading,
|
The file should of course be saved in the right place for autoloading,
|
||||||
for example as @file{/usr/local/share/guile/math/bessel.scm}.
|
for example as @file{/usr/local/share/guile/math/bessel.scm}.
|
||||||
|
|
||||||
|
|
||||||
@page
|
@page
|
||||||
@node Reporting Bugs
|
@node Reporting Bugs
|
||||||
@chapter Reporting Bugs
|
@chapter Reporting Bugs
|
||||||
|
|
|
@ -144,7 +144,7 @@ address these eventually.
|
||||||
@subsection Using Guile Modules
|
@subsection Using Guile Modules
|
||||||
|
|
||||||
To use a Guile module is to access either its public interface or a
|
To use a Guile module is to access either its public interface or a
|
||||||
custom interface (@pxref{General Information About Modules}). Both
|
custom interface (@pxref{General Information about Modules}). Both
|
||||||
types of access are handled by the syntactic form @code{use-modules},
|
types of access are handled by the syntactic form @code{use-modules},
|
||||||
which accepts one or more interface specifications and, upon evaluation,
|
which accepts one or more interface specifications and, upon evaluation,
|
||||||
arranges for those interfaces to be available to the current module.
|
arranges for those interfaces to be available to the current module.
|
||||||
|
|
|
@ -189,10 +189,10 @@ For quick reference, here is the syntax of the formal argument list for
|
||||||
|
|
||||||
@example
|
@example
|
||||||
ext-param-list ::= [identifier]* [#:optional [ext-var-decl]+]?
|
ext-param-list ::= [identifier]* [#:optional [ext-var-decl]+]?
|
||||||
[#:key [ext-var-decl]+ [#:allow-other-keys]?]?
|
[#:key [ext-var-decl]+ [#:allow-other-keys]?]?
|
||||||
[[#:rest identifier]|[. identifier]]?
|
[[#:rest identifier]|[. identifier]]?
|
||||||
|
|
||||||
ext-var-decl ::= identifier | ( identifier expression )
|
ext-var-decl ::= identifier | ( identifier expression )
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
The characters `*', `+' and `?' are not to be taken literally; they mean
|
The characters `*', `+' and `?' are not to be taken literally; they mean
|
||||||
|
@ -231,7 +231,7 @@ two-item list in place of an optional argument, for example in:
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
(lambda* (foo #:optional (bar 42) #:key (baz 73))
|
(lambda* (foo #:optional (bar 42) #:key (baz 73))
|
||||||
(list foo bar baz))
|
(list foo bar baz))
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
@var{foo} is a fixed argument, @var{bar} is an optional argument with
|
@var{foo} is a fixed argument, @var{bar} is an optional argument with
|
||||||
|
@ -446,7 +446,7 @@ Let @code{f} be a variable containing such a @code{foo} data
|
||||||
structure.@footnote{Working definitions would be:
|
structure.@footnote{Working definitions would be:
|
||||||
@lisp
|
@lisp
|
||||||
(define foo-ref vector-ref)
|
(define foo-ref vector-ref)
|
||||||
(define foo-set! vector-set!)
|
(define foo-set! vector-set!)
|
||||||
(define f (make-vector 2 #f))
|
(define f (make-vector 2 #f))
|
||||||
@end lisp
|
@end lisp
|
||||||
}
|
}
|
||||||
|
@ -477,7 +477,7 @@ Let us call this new procedure @code{foo}.
|
||||||
structure stored in @code{f}, or to write into the structure.
|
structure stored in @code{f}, or to write into the structure.
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
(set! (foo f 0) 'dum)
|
(set! (foo f 0) 'dum)
|
||||||
(foo f 0) @result{} dum
|
(foo f 0) @result{} dum
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
|
@ -613,7 +613,7 @@ example of the previous section looks like this:
|
||||||
In Guile, the @code{syntax-rules} system is provided by the @code{(ice-9
|
In Guile, the @code{syntax-rules} system is provided by the @code{(ice-9
|
||||||
syncase)} module. To make these facilities available in your code,
|
syncase)} module. To make these facilities available in your code,
|
||||||
include the expression @code{(use-modules (ice-9 syncase))} or
|
include the expression @code{(use-modules (ice-9 syncase))} or
|
||||||
@code{(use-syntax (ice-9 syncase))} (@pxref{Loading Guile Modules})
|
@code{(use-syntax (ice-9 syncase))} (@pxref{Using Guile Modules})
|
||||||
before the first usage of @code{define-syntax} etc. If you are writing
|
before the first usage of @code{define-syntax} etc. If you are writing
|
||||||
a Scheme module, you can alternatively use one of the keywords
|
a Scheme module, you can alternatively use one of the keywords
|
||||||
@code{#:use-module} and @code{#:use-syntax} in your @code{define-module}
|
@code{#:use-module} and @code{#:use-syntax} in your @code{define-module}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue