mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-19 03:00:25 +02:00
Branched for 1.8 series.
* GUILE-VERSION: Bumped version numbers. * configure.in: Removed --enable-arrays option. * srfi-1.scm, srfi-60.scm: Updated versions in library name to match GUILE-VERSION. * goops.texi (Basic Generic Function Creation): Added blurb about merge-generics duplicates handler from NEWS-
This commit is contained in:
parent
dda1922695
commit
c98f12f1a5
12 changed files with 152 additions and 218 deletions
51
ANNOUNCE
51
ANNOUNCE
|
@ -1,31 +1,25 @@
|
|||
We are pleased to announce the release of Guile 1.7.2. This is a
|
||||
'technology preview' for the upcoming Guile 1.8. It can be found
|
||||
here:
|
||||
We are pleased to announce the release of Guile 1.7.90. This is a
|
||||
release candidate for Guile 1.8. It can be found here:
|
||||
|
||||
ftp://alpha.gnu.org/gnu/guile/guile-1.7.2.tar.gz
|
||||
ftp://alpha.gnu.org/gnu/guile/guile-1.7.90.tar.gz
|
||||
|
||||
Its MD5 checksum is
|
||||
|
||||
7fabb64198993e971f65a27846202388 guile-1.7.2.tar.gz
|
||||
|
||||
This version is guaranteed to contain serious bugs, and the publically
|
||||
visible interfaces will almost certainly change before 1.8 is
|
||||
released. The 1.7 releases might be termed "selected snapshots".
|
||||
|
||||
Specifically, libguile has not yet been reviewed for thread-safeness.
|
||||
|
||||
We are releasing it anyway to start testing the new features, and to
|
||||
get feedback about how well Guile actually behaves in a multi-threaded
|
||||
setting.
|
||||
|
||||
The shared library major versions have been bumped compared to the 1.6
|
||||
series, but they will not be bumped on binary incompatible changes
|
||||
within the 1.7 series.
|
||||
|
||||
|
||||
The NEWS file is quite long. Here are the most interesting entries:
|
||||
|
||||
Changes since 1.7.1:
|
||||
Changes since 1.6:
|
||||
|
||||
* Guile is now licensed with the GNU Lesser General Public License.
|
||||
|
||||
* The manual is now licensed with the GNU Free Documentation License.
|
||||
|
||||
* We now use GNU MP for bignums.
|
||||
|
||||
* We now have exact rationals, such as 1/3.
|
||||
|
||||
* We now use native POSIX threads for real concurrent threads.
|
||||
|
||||
* There is a new way to initalize Guile that allows one to use Guile
|
||||
from threads that have not been created by Guile.
|
||||
|
@ -35,6 +29,23 @@ The NEWS file is quite long. Here are the most interesting entries:
|
|||
|
||||
* The low-level thread API has been removed.
|
||||
|
||||
* There is now support for copy-on-write substrings and
|
||||
mutation-sharing substrings.
|
||||
|
||||
* A new family of functions for converting between C values and
|
||||
Scheme values has been added that is future-proof and thread-safe.
|
||||
|
||||
* The INUM macros like SCM_MAKINUM have been deprecated.
|
||||
|
||||
* The macros SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_LENGTH,
|
||||
SCM_SYMBOL_CHARS, and SCM_SYMBOL_LENGTH have been deprecated.
|
||||
|
||||
* There is a new way to deal with non-local exits and re-entries in
|
||||
C code, which is nicer than scm_internal_dynamic_wind.
|
||||
|
||||
* There are new malloc-like functions that work better than
|
||||
scm_must_malloc, etc.
|
||||
|
||||
* There is a new way to access all kinds of vectors and arrays from
|
||||
C that is efficient and thread-safe.
|
||||
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
2006-02-06 Marius Vollmer <mvo@zagadka.de>
|
||||
|
||||
Branched for 1.8 series.
|
||||
|
||||
* GUILE-VERSION: Bumped version numbers.
|
||||
|
||||
* configure.in: Removed --enable-arrays option.
|
||||
|
||||
2005-12-14 Neil Jerram <neil@ossau.uklinux.net>
|
||||
|
||||
* NEWS: Remove entry claiming that breakpoints have been added,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
GUILE_MAJOR_VERSION=1
|
||||
GUILE_MINOR_VERSION=7
|
||||
GUILE_MICRO_VERSION=2
|
||||
GUILE_MICRO_VERSION=90
|
||||
|
||||
GUILE_EFFECTIVE_VERSION=${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}
|
||||
GUILE_VERSION=${GUILE_EFFECTIVE_VERSION}.${GUILE_MICRO_VERSION}
|
||||
|
@ -21,37 +21,36 @@ PACKAGE=guile
|
|||
# See libtool info pages for more information on how and when to
|
||||
# change these.
|
||||
|
||||
LIBGUILE_INTERFACE_CURRENT=16
|
||||
LIBGUILE_INTERFACE_CURRENT=17
|
||||
LIBGUILE_INTERFACE_REVISION=0
|
||||
LIBGUILE_INTERFACE_AGE=0
|
||||
LIBGUILE_INTERFACE="${LIBGUILE_INTERFACE_CURRENT}:${LIBGUILE_INTERFACE_REVISION}:${LIBGUILE_INTERFACE_AGE}"
|
||||
|
||||
# NOTE: Until 1.8, you must edit each corresponding .scm file (the one
|
||||
# that dynamic-links the relevant lib) if you change the versioning
|
||||
# NOTE: You must edit each corresponding .scm file (the one that
|
||||
# dynamic-links the relevant lib) if you change the versioning
|
||||
# information here to make sure the dynamic-link explicitly loads the
|
||||
# right shared lib version. This requirement should go away before
|
||||
# 1.8 -- see TODO.
|
||||
# right shared lib version.
|
||||
|
||||
LIBGUILE_SRFI_SRFI_1_MAJOR=2
|
||||
LIBGUILE_SRFI_SRFI_1_INTERFACE_CURRENT=2
|
||||
LIBGUILE_SRFI_SRFI_1_MAJOR=3
|
||||
LIBGUILE_SRFI_SRFI_1_INTERFACE_CURRENT=3
|
||||
LIBGUILE_SRFI_SRFI_1_INTERFACE_REVISION=0
|
||||
LIBGUILE_SRFI_SRFI_1_INTERFACE_AGE=0
|
||||
LIBGUILE_SRFI_SRFI_1_INTERFACE="${LIBGUILE_SRFI_SRFI_1_INTERFACE_CURRENT}:${LIBGUILE_SRFI_SRFI_1_INTERFACE_REVISION}:${LIBGUILE_SRFI_SRFI_1_INTERFACE_AGE}"
|
||||
|
||||
LIBGUILE_SRFI_SRFI_4_MAJOR=2
|
||||
LIBGUILE_SRFI_SRFI_4_INTERFACE_CURRENT=2
|
||||
LIBGUILE_SRFI_SRFI_4_MAJOR=3
|
||||
LIBGUILE_SRFI_SRFI_4_INTERFACE_CURRENT=3
|
||||
LIBGUILE_SRFI_SRFI_4_INTERFACE_REVISION=0
|
||||
LIBGUILE_SRFI_SRFI_4_INTERFACE_AGE=0
|
||||
LIBGUILE_SRFI_SRFI_4_INTERFACE="${LIBGUILE_SRFI_SRFI_4_INTERFACE_CURRENT}:${LIBGUILE_SRFI_SRFI_4_INTERFACE_REVISION}:${LIBGUILE_SRFI_SRFI_4_INTERFACE_AGE}"
|
||||
|
||||
LIBGUILE_SRFI_SRFI_13_14_MAJOR=2
|
||||
LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT=2
|
||||
LIBGUILE_SRFI_SRFI_13_14_MAJOR=3
|
||||
LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT=3
|
||||
LIBGUILE_SRFI_SRFI_13_14_INTERFACE_REVISION=0
|
||||
LIBGUILE_SRFI_SRFI_13_14_INTERFACE_AGE=0
|
||||
LIBGUILE_SRFI_SRFI_13_14_INTERFACE="${LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT}:${LIBGUILE_SRFI_SRFI_13_14_INTERFACE_REVISION}:${LIBGUILE_SRFI_SRFI_13_14_INTERFACE_AGE}"
|
||||
|
||||
LIBGUILE_SRFI_SRFI_60_MAJOR=1
|
||||
LIBGUILE_SRFI_SRFI_60_INTERFACE_CURRENT=1
|
||||
LIBGUILE_SRFI_SRFI_60_MAJOR=2
|
||||
LIBGUILE_SRFI_SRFI_60_INTERFACE_CURRENT=2
|
||||
LIBGUILE_SRFI_SRFI_60_INTERFACE_REVISION=0
|
||||
LIBGUILE_SRFI_SRFI_60_INTERFACE_AGE=0
|
||||
LIBGUILE_SRFI_SRFI_60_INTERFACE="${LIBGUILE_SRFI_SRFI_60_INTERFACE_CURRENT}:${LIBGUILE_SRFI_SRFI_60_INTERFACE_REVISION}:${LIBGUILE_SRFI_SRFI_60_INTERFACE_AGE}"
|
||||
|
|
16
INSTALL
16
INSTALL
|
@ -102,16 +102,16 @@ for another architecture.
|
|||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PREFIX'.
|
||||
By default, `make install' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PREFIX', the package will
|
||||
use PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
|
@ -159,7 +159,7 @@ where SYSTEM can have one of these forms:
|
|||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
use the option `--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
|
|
147
NEWS
147
NEWS
|
@ -84,44 +84,7 @@ the '--disable-discouraged' option.
|
|||
(debug-enable 'warn-deprecated) switches them on and (debug-disable
|
||||
'warn-deprecated) switches them off.
|
||||
|
||||
** New module (ice-9 serialize):
|
||||
|
||||
(serialize FORM1 ...) and (parallelize FORM1 ...) are useful when
|
||||
you don't trust the thread safety of most of your program, but
|
||||
where you have some section(s) of code which you consider can run
|
||||
in parallel to other sections.
|
||||
|
||||
### move rest to manual
|
||||
|
||||
They "flag" (with dynamic extent) sections of code to be of
|
||||
"serial" or "parallel" nature and have the single effect of
|
||||
preventing a serial section from being run in parallel with any
|
||||
serial section (including itself).
|
||||
|
||||
Both serialize and parallelize can be nested. If so, the
|
||||
inner-most construct is in effect.
|
||||
|
||||
NOTE 1: A serial section can run in parallel with a parallel
|
||||
section.
|
||||
|
||||
NOTE 2: If a serial section S is "interrupted" by a parallel
|
||||
section P in the following manner: S = S1 P S2, S2 is not
|
||||
guaranteed to be resumed by the same thread that previously
|
||||
executed S1.
|
||||
|
||||
WARNING: Spawning new threads within a serial section have
|
||||
undefined effects. It is OK, though, to spawn threads in unflagged
|
||||
sections of code where neither serialize or parallelize is in
|
||||
effect.
|
||||
|
||||
A typical usage is when Guile is used as scripting language in some
|
||||
application doing heavy computations. If each thread is
|
||||
encapsulated with a serialize form, you can then put a parallelize
|
||||
form around the code performing the heavy computations (typically a
|
||||
C code primitive), enabling the computations to run in parallel
|
||||
while the scripting code runs single-threadedly.
|
||||
|
||||
** Support for SRFI 61, extended cond syntax for multiple valuesm has
|
||||
** Support for SRFI 61, extended cond syntax for multiple values has
|
||||
been added.
|
||||
|
||||
This SRFI is always available.
|
||||
|
@ -161,6 +124,13 @@ The official version is good enough now.
|
|||
Support for translating the documentation into HTML is now always
|
||||
provided. Use 'make html'.
|
||||
|
||||
** New module (ice-9 serialize):
|
||||
|
||||
(serialize FORM1 ...) and (parallelize FORM1 ...) are useful when you
|
||||
don't trust the thread safety of most of your program, but where you
|
||||
have some section(s) of code which you consider can run in parallel to
|
||||
other sections. See ice-9/serialize.scm for more information.
|
||||
|
||||
** The configure option '--disable-arrays' has been removed.
|
||||
|
||||
Support for arrays and uniform numeric arrays is now always included
|
||||
|
@ -244,7 +214,8 @@ array creation has been deprecated. See the manual for more details.
|
|||
|
||||
Some non-compatible changes have been made:
|
||||
- characters can no longer be stored into byte arrays.
|
||||
- strings and bit vectors are no longer considered to be uniform vectors.
|
||||
- strings and bit vectors are no longer considered to be uniform numeric
|
||||
vectors.
|
||||
- array-rank throws an error for non-arrays instead of returning zero.
|
||||
- array-ref does no longer accept non-arrays when no indices are given.
|
||||
|
||||
|
@ -398,41 +369,6 @@ can add the line:
|
|||
|
||||
to your .guile init file.
|
||||
|
||||
### move rest to manual
|
||||
|
||||
The syntax for the :duplicates option is:
|
||||
|
||||
:duplicates HANDLER-NAME | (HANDLER1-NAME HANDLER2-NAME ...)
|
||||
|
||||
Specifying multiple handlers is useful since some handlers (such as
|
||||
replace) can defer conflict resolution to others. Each handler is
|
||||
tried until a binding is selected.
|
||||
|
||||
Currently available duplicates handlers are:
|
||||
|
||||
check report an error for bindings with a common name
|
||||
warn issue a warning for bindings with a common name
|
||||
replace replace bindings which have an imported replacement
|
||||
warn-override-core issue a warning for imports which override core bindings
|
||||
and accept the override
|
||||
first select the first encountered binding (override)
|
||||
last select the last encountered binding (override)
|
||||
|
||||
These two are provided by the (oop goops) module:
|
||||
|
||||
merge-generics merge generic functions with a common name
|
||||
into an <extended-generic>
|
||||
merge-accessors merge accessors with a common name
|
||||
|
||||
The default duplicates handler is:
|
||||
|
||||
(replace warn-override-core warn last)
|
||||
|
||||
A recommended handler (which is likely to correspond to future Guile
|
||||
behavior) can be installed with:
|
||||
|
||||
(default-duplicate-binding-handler '(replace warn-override-core check))
|
||||
|
||||
** New define-module option: :replace
|
||||
|
||||
:replace works as :export, but, in addition, marks the binding as a
|
||||
|
@ -458,63 +394,6 @@ When two imported bindings conflict and they are both generic
|
|||
functions, the two functions can now be merged automatically. This is
|
||||
activated with the 'duplicates' handler 'merge-generics'.
|
||||
|
||||
### move the rest to the manual
|
||||
|
||||
It is sometimes tempting to use GOOPS accessors with short names.
|
||||
For example, it is tempting to use the name `x' for the x-coordinate
|
||||
in vector packages.
|
||||
|
||||
Assume that we work with a graphical package which needs to use two
|
||||
independent vector packages for 2D and 3D vectors respectively. If
|
||||
both packages export `x' we will encounter a name collision.
|
||||
|
||||
This can now be resolved automagically with the duplicates handler
|
||||
`merge-generics' which gives the module system license to merge all
|
||||
generic functions sharing a common name:
|
||||
|
||||
(define-module (math 2D-vectors)
|
||||
:use-module (oop goops)
|
||||
:export (x y ...))
|
||||
|
||||
(define-module (math 3D-vectors)
|
||||
:use-module (oop goops)
|
||||
:export (x y z ...))
|
||||
|
||||
(define-module (my-module)
|
||||
:use-module (math 2D-vectors)
|
||||
:use-module (math 3D-vectors)
|
||||
:duplicates merge-generics)
|
||||
|
||||
x in (my-module) will now share methods with x in both imported
|
||||
modules.
|
||||
|
||||
There will, in fact, now be three distinct generic functions named
|
||||
`x': x in (2D-vectors), x in (3D-vectors), and x in (my-module). The
|
||||
last function will be an <extended-generic>, extending the previous
|
||||
two functions.
|
||||
|
||||
Let's call the imported generic functions the "ancestor functions". x
|
||||
in (my-module) is, in turn, a "descendant function" of the imported
|
||||
functions, extending its ancestors.
|
||||
|
||||
For any generic function G, the applicable methods are selected from
|
||||
the union of the methods of the descendant functions, the methods of G
|
||||
itself and the methods of the ancestor functions.
|
||||
|
||||
This, ancestor functions share methods with their descendants and vice
|
||||
versa. This implies that x in (math 2D-vectors) can will share the
|
||||
methods of x in (my-module) and vice versa, while x in (math 2D-vectors)
|
||||
doesn't share the methods of x in (math 3D-vectors), thus preserving
|
||||
modularity.
|
||||
|
||||
Sharing is dynamic, so that adding new methods to a descendant implies
|
||||
adding it to the ancestor.
|
||||
|
||||
If duplicates checking is desired in the above example, the following
|
||||
form of the :duplicates option can be used instead:
|
||||
|
||||
:duplicates (merge-generics check)
|
||||
|
||||
** New function: effective-version
|
||||
|
||||
Returns the "effective" version number. This is just the normal full
|
||||
|
@ -529,11 +408,11 @@ threads. See "Parallel forms" in the manual for details.
|
|||
** New function 'try-mutex'.
|
||||
|
||||
This function will attempt to lock a mutex but will return immediately
|
||||
instead if blocking and indicate failure.
|
||||
instead of blocking and indicate failure.
|
||||
|
||||
** Waiting on a condition variable can have a timeout.
|
||||
|
||||
The funtion 'wait-condition-variable' now takes a third, optional
|
||||
The function 'wait-condition-variable' now takes a third, optional
|
||||
argument that specifies the point in time where the waiting should be
|
||||
aborted.
|
||||
|
||||
|
@ -1062,7 +941,7 @@ scm_c_call_with_unblocked_asyncs instead.
|
|||
** New way to temporarily set the current input, output or error ports
|
||||
|
||||
C code can now use scm_dynwind_current_<foo>_port in a 'dynwind
|
||||
conetxt' (see above). <foo> is one of "input", "output" or "error".
|
||||
context' (see above). <foo> is one of "input", "output" or "error".
|
||||
|
||||
** New way to temporarily set fluids
|
||||
|
||||
|
|
41
README
41
README
|
@ -1,20 +1,9 @@
|
|||
!!! This is not a Guile release; it is a source tree retrieved via
|
||||
anonymous CVS or as a nightly snapshot at some random time after the
|
||||
Guile 1.6 release. If this were a Guile release, you would not see
|
||||
this message. !!! [fixme: zonk on release]
|
||||
|
||||
This is a 1.7 development version of Guile, Project GNU's extension
|
||||
language library. Guile is an interpreter for Scheme, packaged as a
|
||||
library that you can link into your applications to give them their
|
||||
own scripting language. Guile will eventually support other languages
|
||||
as well, giving users of Guile-based applications a choice of
|
||||
languages.
|
||||
|
||||
Guile versions with an odd middle number, i.e. 1.7.* are unstable
|
||||
development versions. Even middle numbers indicate stable versions.
|
||||
This has been the case since the 1.3.* series.
|
||||
|
||||
The next stable release will be version 1.8.0.
|
||||
This version 1.7.90 of Guile (a release candidate for 1.8.0), Project
|
||||
GNU's extension language library. Guile is an interpreter for Scheme,
|
||||
packaged as a library that you can link into your applications to give
|
||||
them their own scripting language. Guile will eventually support
|
||||
other languages as well, giving users of Guile-based applications a
|
||||
choice of languages.
|
||||
|
||||
Please send bug reports to bug-guile@gnu.org.
|
||||
|
||||
|
@ -193,7 +182,6 @@ switches specific to Guile you may find useful in some circumstances.
|
|||
number of objects of that kind.
|
||||
|
||||
--enable-guile-debug --- Include internal debugging functions
|
||||
--disable-arrays --- omit array and uniform array support
|
||||
--disable-posix --- omit posix interfaces
|
||||
--disable-networking --- omit networking interfaces
|
||||
--disable-regex --- omit regular expression interfaces
|
||||
|
@ -357,11 +345,6 @@ libguile:
|
|||
ice-9: Guile's module system, initialization code, and other infrastructure.
|
||||
guile-config:
|
||||
Source for the guile-config script.
|
||||
qt: A cooperative threads package from the University of Washington,
|
||||
which Guile can use. If you configure Guile with the
|
||||
--with-threads flag, you will need to link against the -lqt
|
||||
library, found in this directory. Qt is under a separate
|
||||
copyright; see `qt/README' for more details.
|
||||
guile-readline:
|
||||
The glue code for using GNU readline with Guile. This
|
||||
will be build when configure can find a recent enough readline
|
||||
|
@ -379,15 +362,3 @@ Guile CVS repository, you can subscribe to guile-cvs@gnu.org by the
|
|||
Mailman mailing list interface at
|
||||
|
||||
<http://mail.gnu.org/mailman/listinfo/guile-cvs>
|
||||
|
||||
|
||||
Obtaining Guile ======================================================
|
||||
|
||||
The latest official Guile release is available via anonymous FTP from
|
||||
|
||||
ftp://ftp.gnu.org/pub/gnu/guile/guile-1.4.tar.gz
|
||||
|
||||
The mailing list `guile-user@gnu.org' carries discussions, questions,
|
||||
and often answers, about Guile. To subscribe, use the Mailman mailing
|
||||
list interface at <http://mail.gnu.org/mailman/listinfo/guile-user>
|
||||
Of course, please send bug reports (and fixes!) to bug-guile@gnu.org.
|
||||
|
|
|
@ -118,11 +118,6 @@ AC_ARG_ENABLE(guile-debug,
|
|||
SCM_I_GSC_GUILE_DEBUG=1
|
||||
fi)
|
||||
|
||||
AC_ARG_ENABLE(arrays,
|
||||
[AC_HELP_STRING([--disable-arrays],[omit array and uniform array support])],
|
||||
,
|
||||
enable_arrays=yes)
|
||||
|
||||
AC_ARG_ENABLE(posix,
|
||||
[ --disable-posix omit posix interfaces],,
|
||||
enable_posix=yes)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2006-02-06 Marius Vollmer <mvo@zagadka.de>
|
||||
|
||||
* goops.texi (Basic Generic Function Creation): Added blurb about
|
||||
merge-generics duplicates handler from NEWS-
|
||||
|
||||
2004-06-28 Marius Vollmer <marius.vollmer@uni-dortmund.de>
|
||||
|
||||
* Makefile.am: Removed home-grown code for HTML generation.
|
||||
|
|
|
@ -1541,6 +1541,67 @@ including an existing generic function or accessor, is overwritten by
|
|||
the new definition.
|
||||
@end deffn
|
||||
|
||||
It is sometimes tempting to use GOOPS accessors with short names. For
|
||||
example, it is tempting to use the name @code{x} for the x-coordinate
|
||||
in vector packages.
|
||||
|
||||
Assume that we work with a graphical package which needs to use two
|
||||
independent vector packages for 2D and 3D vectors respectively. If
|
||||
both packages export @code{x} we will encounter a name collision.
|
||||
|
||||
This can be resolved automagically with the duplicates handler
|
||||
@code{merge-generics} which gives the module system license to merge
|
||||
all generic functions sharing a common name:
|
||||
|
||||
@smalllisp
|
||||
(define-module (math 2D-vectors)
|
||||
:use-module (oop goops)
|
||||
:export (x y ...))
|
||||
|
||||
(define-module (math 3D-vectors)
|
||||
:use-module (oop goops)
|
||||
:export (x y z ...))
|
||||
|
||||
(define-module (my-module)
|
||||
:use-module (math 2D-vectors)
|
||||
:use-module (math 3D-vectors)
|
||||
:duplicates merge-generics)
|
||||
@end smalllisp
|
||||
|
||||
The generic function @code{x} in @code{(my-module)} will now share
|
||||
methods with @code{x} in both imported modules.
|
||||
|
||||
There will, in fact, now be three distinct generic functions named
|
||||
@code{x}: @code{x} in @code{(2D-vectors)}, @code{x} in
|
||||
@code{(3D-vectors)}, and @code{x} in @code{(my-module)}. The last
|
||||
function will be an @code{<extended-generic>}, extending the previous
|
||||
two functions.
|
||||
|
||||
Let's call the imported generic functions the "ancestor functions".
|
||||
The generic function @code{x} in @code{(my-module)} is, in turn, a
|
||||
"descendant function" of the imported functions, extending its
|
||||
ancestors.
|
||||
|
||||
For any generic function G, the applicable methods are selected from
|
||||
the union of the methods of the descendant functions, the methods of G
|
||||
itself and the methods of the ancestor functions.
|
||||
|
||||
This, ancestor functions share methods with their descendants and vice
|
||||
versa. This implies that @code{x} in @code{(math 2D-vectors)} will
|
||||
share the methods of @code{x} in @code{(my-module)} and vice versa,
|
||||
while @code{x} in @code{(math 2D-vectors)} doesn't share the methods
|
||||
of @code{x} in @code{(math 3D-vectors)}, thus preserving modularity.
|
||||
|
||||
Sharing is dynamic, so that adding new methods to a descendant implies
|
||||
adding it to the ancestor.
|
||||
|
||||
If duplicates checking is desired in the above example, the following
|
||||
form of the @code{:duplicates} option can be used instead:
|
||||
|
||||
@smalllisp
|
||||
:duplicates (merge-generics check)
|
||||
@end smalllisp
|
||||
|
||||
@node Generic Function Internals
|
||||
@subsection Generic Function Internals
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2006-02-06 Marius Vollmer <mvo@zagadka.de>
|
||||
|
||||
* srfi-1.scm, srfi-60.scm: Updated versions in library name to
|
||||
match GUILE-VERSION.
|
||||
|
||||
2006-02-04 Kevin Ryde <user42@zip.com.au>
|
||||
|
||||
* srfi-1.c (scm_srfi1_delete, scm_srfi1_delete_duplicates): Use a
|
||||
|
|
|
@ -220,7 +220,7 @@
|
|||
|
||||
;; Load the compiled primitives from the shared library.
|
||||
;;
|
||||
(load-extension "libguile-srfi-srfi-1-v-2" "scm_init_srfi_1")
|
||||
(load-extension "libguile-srfi-srfi-1-v-3" "scm_init_srfi_1")
|
||||
|
||||
|
||||
;;; Constructors
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
logbit?
|
||||
ash))
|
||||
|
||||
(load-extension "libguile-srfi-srfi-60-v-1" "scm_init_srfi_60")
|
||||
(load-extension "libguile-srfi-srfi-60-v-2" "scm_init_srfi_60")
|
||||
|
||||
(define bitwise-and logand)
|
||||
(define bitwise-ior logior)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue