mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 20:00:19 +02:00
Added more words to #:replace from Ludovic. Thanks!
This commit is contained in:
parent
a81d0de109
commit
e724644d45
1 changed files with 24 additions and 9 deletions
|
@ -456,17 +456,32 @@ will have the effect of replacing any binding with the same name that
|
||||||
is not also ``replacing''. Normally a replacement results in an
|
is not also ``replacing''. Normally a replacement results in an
|
||||||
``override'' warning message, @code{#:replace} avoids that.
|
``override'' warning message, @code{#:replace} avoids that.
|
||||||
|
|
||||||
This can be used by a module extending a core function in an upwardly
|
This is useful for modules that export bindings that have the same
|
||||||
compatible way, like SRFI-39 @code{current-input-port}
|
name as core bindings. @code{#:replace}, in a sense, lets Guile know
|
||||||
(@pxref{SRFI-39}).
|
that the module @emph{purposefully} replaces a core binding. It is
|
||||||
|
important to note, however, that this binding replacement is confined
|
||||||
|
to the name space of the module user. In other words, the value of the
|
||||||
|
core binding in question remains unchanged for other modules.
|
||||||
|
|
||||||
Or it can be used by a module which is intentionally producing a new
|
For instance, SRFI-39 exports a binding named
|
||||||
special kind of environment and should override any core or other
|
@code{current-input-port} (@pxref{SRFI-39}) that is a function which
|
||||||
bindings already in scope. For example perhaps a logic processing
|
is upwardly compatible with the core @code{current-input-port}
|
||||||
environment where @code{<=} is an inference instead of a comparison.
|
function. Therefore, SRFI-39 exports its version with
|
||||||
|
@code{#:replace}.
|
||||||
|
|
||||||
@code{#:duplicates} below provides fine-grain control about duplicate
|
SRFI-19, on the other hand, exports its own version of
|
||||||
binding handling on the module-user side.
|
@code{current-time} (@pxref{SRFI-19 Time}) which is not compatible
|
||||||
|
with the core @code{current-time} function (@pxref{Time}). Therefore,
|
||||||
|
SRFI-19 does not use @code{#:replace}.
|
||||||
|
|
||||||
|
The @code{#:replace} option can also be used by a module which is
|
||||||
|
intentionally producing a new special kind of environment and should
|
||||||
|
override any core or other bindings already in scope. For example
|
||||||
|
perhaps a logic processing environment where @code{<=} is an inference
|
||||||
|
instead of a comparison.
|
||||||
|
|
||||||
|
The @code{#:duplicates} (see below) provides fine-grain control about
|
||||||
|
duplicate binding handling on the module-user side.
|
||||||
|
|
||||||
@item #:duplicates @var{list}
|
@item #:duplicates @var{list}
|
||||||
@cindex duplicate binding handlers
|
@cindex duplicate binding handlers
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue