[Top][All Lists]

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

Re: [PATCH] SRFI-34, SRFI-60 and core bindings

From: Marius Vollmer
Subject: Re: [PATCH] SRFI-34, SRFI-60 and core bindings
Date: Tue, 13 Dec 2005 23:55:04 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

address@hidden (Ludovic Courtès) writes:

> See also:
> .
>> If you don't want to warning, you can define your own way of handling
>> duplicates.  See the NEWS file for docs about the options.
> Precisely, you said you were ok to apply the following documentation
> yesterday:
>   This is useful for modules that export bindings that have the same
>   name as core bindings.  @code{#:replace}, in a sense, lets Guile know
>   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.
> So, do we agree on what `#:replace' is for?  :-)

My understanding of #:replace goes along these lines: Importing more
than one binding with the same name into a module should be avoided,
and we should make it an error.  But since it was traditonally allowed
by Guile, we merely warn about it.

However, sometimes one of the bindings is a useful replacement for the
other in the sense that it is fully compatible with it.  In that
situation, it is a nice service by the module system to automatically
choose the replacement and not give a warning.  In that scenario,
using a module is not only a way of saying what set of names you want
to use, but also a way of saying what level of functionality one wants
to have for a name that might also be available without using that
module.  You can use #:replace to mark those bindings that are useful
replacements in this sense to get rid of the useless warning.

When using #:replace, the exporting module is making the promise that
the warning can be surpressed because everything is alright.  It can
only do that if the replacing binding is compatible with what it

Often, the user of a module also knows that everything is alright and
wants to surpress the warning.  (That's where you come in,
Ludovic. :-) The user can only do that by giving parameters to
use-modules or its own define-module.  He should not go and add a
#:replace to the exporting module.  The only ways to do avoid the
duplicate warning for a module user currently are to rename the
bindings on import, or to use an explicit #:duplicates handler.
(Right?  Anything else?)

> As a matter of fact, this facility had remained undocumented for years
> and its original author is no longer here (I think) to explain the
> rationale behind it.

Hmm, I think current usage is in line with what I described above.

GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405

reply via email to

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