guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-200-geb7da


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-200-geb7da3d
Date: Fri, 27 Jan 2012 16:02:43 +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".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=eb7da3d81f565ae20b0a35dda0607537e969ff59

The branch, stable-2.0 has been updated
       via  eb7da3d81f565ae20b0a35dda0607537e969ff59 (commit)
       via  0740cb49d1509c56184fc6802b4347ed8fc80a28 (commit)
      from  40e92f09fc3330aa33a169ad1aa6bf458633984c (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 eb7da3d81f565ae20b0a35dda0607537e969ff59
Author: Andy Wingo <address@hidden>
Date:   Fri Jan 27 16:26:36 2012 +0100

    document `include', `include-from-path'
    
    * doc/ref/api-evaluation.texi (Local Inclusion): New section.

commit 0740cb49d1509c56184fc6802b4347ed8fc80a28
Author: Andy Wingo <address@hidden>
Date:   Fri Jan 27 13:11:58 2012 +0100

    more documentation on the process of loading source and compiled files
    
    * doc/ref/api-evaluation.texi (Load Paths): Move documentation of
      %load-path and related procedures here, from Build Config.  Add docs
      for %load-compiled-path.
    
    * doc/ref/api-foreign.texi:
    * doc/ref/api-modules.texi:
    * doc/ref/api-options.texi:
    * doc/ref/scheme-using.texi: Update xrefs.

-----------------------------------------------------------------------

Summary of changes:
 doc/ref/api-evaluation.texi |  140 ++++++++++++++++++++++++++++++++++++++++---
 doc/ref/api-foreign.texi    |   10 ++--
 doc/ref/api-modules.texi    |    6 +-
 doc/ref/api-options.texi    |   50 +++-------------
 doc/ref/scheme-using.texi   |    5 +-
 5 files changed, 151 insertions(+), 60 deletions(-)

diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi
index f2b539e..90cae45 100644
--- a/doc/ref/api-evaluation.texi
+++ b/doc/ref/api-evaluation.texi
@@ -21,6 +21,7 @@ loading, evaluating, and compiling Scheme code at run time.
 * Character Encoding of Source Files:: Loading non-ASCII Scheme code from file.
 * Delayed Evaluation::          Postponing evaluation until it is needed.
 * Local Evaluation::            Evaluation in a local lexical environment.
+* Local Inclusion::             Compile-time inclusion of one file in another.
 @end menu
 
 
@@ -808,7 +809,15 @@ The procedure in the previous section look for Scheme code 
in the file
 system at specific location.  Guile also has some procedures to search
 the load path for code.
 
-For more on the @code{%load-path} variable, @xref{Build Config}.
address@hidden @env{GUILE_LOAD_PATH}
address@hidden %load-path
+List of directories which should be searched for Scheme modules and
+libraries.  @code{%load-path} is initialized when Guile starts up to
address@hidden(list (%site-dir) (%library-dir) (%package-data-dir))}, prepended
+with the contents of the @env{GUILE_LOAD_PATH} environment variable, if
+it is set.  @xref{Build Config}, for more on @code{%site-dir} and
+related procedures.
address@hidden defvar
 
 @deffn {Scheme Procedure} load-from-path filename
 Similar to @code{load}, but searches for @var{filename} in the load
@@ -820,6 +829,7 @@ A user can extend the load path by calling 
@code{add-to-load-path}.
 
 @deffn {Scheme Syntax} add-to-load-path dir
 Add @var{dir} to the load path.
address@hidden deffn
 
 For example, a script might include this form to add the directory that
 it is in to the load path:
@@ -827,7 +837,6 @@ it is in to the load path:
 @example
 (add-to-load-path (dirname (current-filename)))
 @end example
address@hidden deffn
 
 It's better to use @code{add-to-load-path} than to modify
 @code{%load-path} directly, because @code{add-to-load-path} takes care
@@ -851,12 +860,11 @@ the C function takes only one argument, which can be 
either a string
 
 @deffn {Scheme Procedure} %search-load-path filename
 @deffnx {C Function} scm_sys_search_load_path (filename)
-Search @code{%load-path} for the file named @var{filename},
-which must be readable by the current user.  If @var{filename}
-is found in the list of paths to search or is an absolute
-pathname, return its full pathname.  Otherwise, return
address@hidden  Filenames may have any of the optional extensions
-in the @code{%load-extensions} list; @code{%search-load-path}
+Search @code{%load-path} for the file named @var{filename}, which must
+be readable by the current user.  If @var{filename} is found in the list
+of paths to search or is an absolute pathname, return its full pathname.
+Otherwise, return @code{#f}.  Filenames may have any of the optional
+extensions in the @code{%load-extensions} list; @code{%search-load-path}
 will try each extension automatically.
 @end deffn
 
@@ -867,6 +875,61 @@ a file to load.  By default, @code{%load-extensions} is 
bound to the
 list @code{("" ".scm")}.
 @end defvar
 
+As mentioned above, when Guile searches the @code{%load-path} for a
+source file, it will also search the @code{%load-compiled-path} for a
+corresponding compiled file.  If the compiled file is as new or newer
+than the source file, it will be loaded instead of the source file,
+using @code{load-compiled}.
+
address@hidden %load-compiled-path
+Like @code{%load-path}, but for compiled files.  By default, this path
+has two entries: one for compiled files from Guile itself, and one for
+site packages.
address@hidden defvar
+
+When @code{primitive-load-path} searches the @code{%load-compiled-path}
+for a corresponding compiled file for a relative path it does so by
+appending @code{.go} to the relative path.  For example, searching for
address@hidden/popen} could find
address@hidden/usr/lib/guile/2.0/ccache/ice-9/popen.go}, and use it instead of
address@hidden/usr/share/guile/2.0/ice-9/popen.scm}.
+
+If @code{primitive-load-path} does not find a corresponding @code{.go}
+file in the @code{%load-compiled-path}, or the @code{.go} file is out of
+date, it will search for a corresponding auto-compiled file in the
+fallback path, possibly creating one if one does not exist.
+
address@hidden Site Packages}, for more on how to correctly install
+site packages.  @xref{Modules and the File System}, for more on the
+relationship between load paths and modules.  @xref{Compilation}, for
+more on the fallback path and auto-compilation.
+
+Finally, there are a couple of helper procedures for general path
+manipulation.
+
address@hidden {Scheme Procedure} parse-path path [tail]
address@hidden {C Function} scm_parse_path (path, tail)
+Parse @var{path}, which is expected to be a colon-separated string, into
+a list and return the resulting list with @var{tail} appended. If
address@hidden is @code{#f}, @var{tail} is returned.
address@hidden deffn
+
address@hidden {Scheme Procedure} search-path path filename [extensions 
[require-exts?]]
address@hidden {C Function} scm_search_path (path, filename, rest)
+Search @var{path} for a directory containing a file named
address@hidden The file must be readable, and not a directory.  If we
+find one, return its full filename; otherwise, return @code{#f}.  If
address@hidden is absolute, return it unchanged.  If given,
address@hidden is a list of strings; for each directory in @var{path},
+we search for @var{filename} concatenated with each @var{extension}.  If
address@hidden  is true, require that the returned file name have
+one of the given extensions; if @var{require-exts?} is not given, it
+defaults to @code{#f}.
+
+For compatibility with Guile 1.8 and earlier, the C function takes only
+three arguments.
address@hidden deffn
+
 
 @node Character Encoding of Source Files
 @subsection Character Encoding of Source Files
@@ -1039,6 +1102,67 @@ captured syntactic keywords via @code{local-eval} or
 @code{local-compile} produces an error.
 
 
address@hidden Local Inclusion
address@hidden Local Inclusion
+
+This section has discussed various means of linking Scheme code
+together: fundamentally, loading up files at run-time using @code{load}
+and @code{load-compiled}.  Guile provides another option to compose
+parts of programs together at expansion-time instead of at run-time.
+
address@hidden {Scheme Syntax} include file-name
+Open @var{file-name}, at expansion-time, and read the Scheme forms that
+it contains, splicing them into the location of the @code{include},
+within a @code{begin}.
address@hidden deffn
+
+If you are a C programmer, if @code{load} in Scheme is like
address@hidden in C, consider @code{include} to be like the C
+preprocessor's @code{#include}.  When you use @code{include}, it is as
+if the contents of the included file were typed in instead of the
address@hidden form.
+
+Because the code is included at compile-time, it is available to the
+macroexpander.  Syntax definitions in the included file are available to
+later code in the form in which the @code{include} appears, without the
+need for @code{eval-when}.  (@xref{Eval When}.)
+
+For the same reason, compiling a form that uses @code{include} results
+in one compilation unit, composed of multiple files.  Loading the
+compiled file is one @code{stat} operation for the compilation unit,
+instead of @address@hidden in the case of @code{load} (once for each
+loaded source file, and once each corresponding compiled file, in the
+best case).
+
+Unlike @code{load}, @code{include} also works within nested lexical
+contexts.  It so happens that the optimizer works best within a lexical
+context, because all of the uses of bindings in a lexical context are
+visible, so composing files by including them within a @code{(let ()
+...)} can sometimes lead to important speed improvements.
+
+On the other hand, @code{include} does have all the disadvantages of
+early binding: once the code with the @code{include} is compiled, no
+change to the included file is reflected in the future behavior of the
+including form.
+
+Also, the particular form of @code{include}, which requires an absolute
+path, or a path relative to the current directory at compile-time, is
+not very amenable to compiling the source in one place, but then
+installing the source to another place.  For this reason, Guile provides
+another form, @code{include-from-path}, which looks for the source file
+to include within a load path.
+
address@hidden {Scheme Syntax} include-from-path file-name
+Like @code{include}, but instead of expecting @code{file-name} to be an
+absolute file name, it is expected to be a relative path to search in
+the @code{%load-path}.
address@hidden deffn
+
address@hidden is more useful when you want to install all of
+the source files for a package (as you should!).  It makes it possible
+to evaluate an installed file from source, instead of relying on the
address@hidden file being up to date.
+
 @c Local Variables:
 @c TeX-master: "guile.texi"
 @c End:
diff --git a/doc/ref/api-foreign.texi b/doc/ref/api-foreign.texi
index 82925e6..6ece7f8 100644
--- a/doc/ref/api-foreign.texi
+++ b/doc/ref/api-foreign.texi
@@ -425,11 +425,11 @@ its own @code{gettext} message catalogue
 (@pxref{Internationalization}).
 
 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
-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.
+found in @code{%load-path} (@pxref{Load Paths}).  Presently it's left up
+to the system administrator or each user to augment that path 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.
 
 
 @node Foreign Pointers
diff --git a/doc/ref/api-modules.texi b/doc/ref/api-modules.texi
index 3c96c2a..b9f9758 100644
--- a/doc/ref/api-modules.texi
+++ b/doc/ref/api-modules.texi
@@ -98,8 +98,8 @@ types of access are handled by the syntactic form 
@code{use-modules},
 which accepts one or more interface specifications and, upon evaluation,
 arranges for those interfaces to be available to the current module.
 This process may include locating and loading code for a given module if
-that code has not yet been loaded, following @code{%load-path} (@pxref{Build
-Config}).
+that code has not yet been loaded, following @code{%load-path}
+(@pxref{Modules and the File System}).
 
 An @dfn{interface specification} has one of two forms.  The first
 variation is simply to name the module, in which case its public
@@ -464,7 +464,7 @@ from in the @dfn{load path}.
 In this case, loading @code{(ice-9 popen)} will eventually cause Guile
 to run @code{(primitive-load-path "ice-9/popen")}.
 @code{primitive-load-path} will search for a file @file{ice-9/popen} in
-the @code{%load-path} (@pxref{Build Config}).  For each directory in
+the @code{%load-path} (@pxref{Load Paths}).  For each directory in
 @code{%load-path}, Guile will try to find the file name, concatenated
 with the extensions from @code{%load-extensions}.  By default, this will
 cause Guile to @code{stat} @file{ice-9/popen.scm}, and then
diff --git a/doc/ref/api-options.texi b/doc/ref/api-options.texi
index 6f7568b..f635978 100644
--- a/doc/ref/api-options.texi
+++ b/doc/ref/api-options.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, 2005, 
2006, 2008, 2009, 2010, 2011
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 
2006, 2008, 2009, 2010, 2011, 2012
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -59,14 +59,14 @@ The @code{effective-version} function returns the version 
name that
 should remain unchanged during a stable series.  Currently that means
 that it omits the micro version.  The effective version should be used
 for items like the versioned share directory name
-i.e.@: @file{/usr/share/guile/1.6/}
+i.e.@: @file{/usr/share/guile/2.0/}
 
 @lisp
-(version) @result{} "1.6.0"
-(effective-version) @result{} "1.6"
-(major-version) @result{} "1"
-(minor-version) @result{} "6"
-(micro-version) @result{} "0"
+(version) @result{} "2.0.4"
+(effective-version) @result{} "2.0"
+(major-version) @result{} "2"
+(minor-version) @result{} "0"
+(micro-version) @result{} "4"
 @end lisp
 @end deffn
 
@@ -86,7 +86,7 @@ party package) are installed.  On Unix-like systems this is 
usually
 @file{/usr/share/guile/@var{GUILE_EFFECTIVE_VERSION}};
 
 @noindent
-for example @file{/usr/local/share/guile/1.6}.
+for example @file{/usr/local/share/guile/2.0}.
 @end deffn
 
 @deffn {Scheme Procedure} %site-dir
@@ -96,40 +96,6 @@ your site should be installed.  On Unix-like systems, this 
is usually
 @file{/usr/local/share/guile/site} or @file{/usr/share/guile/site}.
 @end deffn
 
address@hidden @env{GUILE_LOAD_PATH}
address@hidden %load-path
-List of directories which should be searched for Scheme modules and
-libraries.  @code{%load-path} is initialized when Guile starts up to
address@hidden(list (%site-dir) (%library-dir) (%package-data-dir))},
-prepended with the contents of the @env{GUILE_LOAD_PATH} environment variable,
-if it is set.
address@hidden defvar
-
address@hidden {Scheme Procedure} parse-path path [tail]
address@hidden {C Function} scm_parse_path (path, tail)
-Parse @var{path}, which is expected to be a colon-separated
-string, into a list and return the resulting list with
address@hidden appended. If @var{path} is @code{#f}, @var{tail}
-is returned.
address@hidden deffn
-
address@hidden {Scheme Procedure} search-path path filename [extensions 
[require-exts?]]
address@hidden {C Function} scm_search_path (path, filename, rest)
-Search @var{path} for a directory containing a file named
address@hidden The file must be readable, and not a directory.
-If we find one, return its full filename; otherwise, return
address@hidden  If @var{filename} is absolute, return it unchanged.
-If given, @var{extensions} is a list of strings; for each
-directory in @var{path}, we search for @var{filename}
-concatenated with each @var{extension}.  If @var{require-exts?}
-is true, require that the returned file name have one of the
-given extensions; if @var{require-exts?} is not given, it
-defaults to @code{#f}.
-
-For compatibility with Guile 1.8 and earlier, the C function takes only
-three arguments
address@hidden deffn
-
 @defvar %guile-build-info
 Alist of information collected during the building of a particular
 Guile.  Entries can be grouped into one of several categories:
diff --git a/doc/ref/scheme-using.texi b/doc/ref/scheme-using.texi
index 07096bb..ae608d7 100644
--- a/doc/ref/scheme-using.texi
+++ b/doc/ref/scheme-using.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C) 2006, 2010, 2011
address@hidden Copyright (C) 2006, 2010, 2011, 2012
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -780,7 +780,8 @@ site packages will be
 
 Note that a @code{.go} file will only be loaded in preference to a
 @code{.scm} file if it is newer.  For that reason, you should install
-your Scheme files first, and your compiled files second.
+your Scheme files first, and your compiled files second.  @code{Load
+Paths}, for more on the loading process.
 
 Finally, although this section is only about Scheme, sometimes you need
 to install C extensions too.  Shared libraries should be installed in


hooks/post-receive
-- 
GNU Guile



reply via email to

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