[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
when to #:replace
From: |
Andy Wingo |
Subject: |
when to #:replace |
Date: |
Sun, 20 Jun 2010 22:57:31 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) |
Hello,
As you probably know, Guile is fairly flexible when dealing with
duplicate bindings -- one can warn, error, choose the last one, first
one, etc.
But currently there are lots of warnings, way too many. For example just
using srfi-69 gives you a warning:
WARNING: (guile-user): imported module (srfi srfi-69) overrides core binding
`make-hash-table'
So I think there is confusion among both users and developers of Guile.
I thought a little about the problem and here's a kind of FAQ regarding
duplicate bindings:
Q: I have a module that overrides a core binding (like
make-hash-table). Should I #:export that binding or #:replace it?
A: #:replace. Presumably the user knows what she is doing when she
uses your module. If she really cares she can change the duplicate
bindings resolution mechanism to disallow such imports.
Q: How do I suppress duplicate bindings warnings?
A: Fix your module so that you rename one of the bindings on import.
Q: How do I suppress a "overrides core binding" warning when importing
a module?
A: Fix that module so that it uses #:replace for that binding instead
of #:export.
Now, off to fix R6RS modules in this regard...
Andy
--
http://wingolog.org/
- when to #:replace,
Andy Wingo <=