mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 12:20:26 +02:00
* boot-9.scm (ipow-by-squaring): Removed.
(default-duplicate-binding-handler): Set default to '(replace warn last)
This commit is contained in:
parent
0c160c7339
commit
fe6ee0528b
3 changed files with 28 additions and 21 deletions
31
NEWS
31
NEWS
|
@ -63,23 +63,32 @@ debugging evaluator gives better error messages.
|
|||
|
||||
** Checking for duplicate bindings in module system
|
||||
|
||||
The module system now checks for duplicate imported bindings.
|
||||
The module system now can check for name conflicts among imported
|
||||
bindings.
|
||||
|
||||
The behavior can be controlled by specifying one or more duplicates
|
||||
handlers. For example, to get back the old behavior (which was to use
|
||||
the last imported binding of a certain name), write:
|
||||
handlers. For example, to make Guile return an error for every name
|
||||
collision, write:
|
||||
|
||||
(define-module (foo)
|
||||
:use-module (bar)
|
||||
:use-module (baz)
|
||||
:duplicates last)
|
||||
:duplicates check)
|
||||
|
||||
If you want the old behavior without changing your module headers, put
|
||||
the line:
|
||||
The new default behavior of the module system when a name collision
|
||||
has been detected is to
|
||||
|
||||
1. Give priority to bindings marked as a replacement.
|
||||
2. Issue a warning.
|
||||
3. Give priority to the last encountered binding (this corresponds to
|
||||
the old behavior).
|
||||
|
||||
If you want the old behavior back without replacements or warnings you
|
||||
can add the line:
|
||||
|
||||
(default-duplicate-binding-handler 'last)
|
||||
|
||||
in your .guile init file.
|
||||
to your .guile init file.
|
||||
|
||||
The syntax for the :duplicates option is:
|
||||
|
||||
|
@ -95,6 +104,7 @@ Currently available duplicates handlers are:
|
|||
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)
|
||||
|
||||
|
@ -106,7 +116,12 @@ These two are provided by the (oop goops) module:
|
|||
|
||||
The default duplicates handler is:
|
||||
|
||||
(replace warn-override-core check)
|
||||
(replace 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
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
2003-03-12 Mikael Djurfeldt <djurfeldt@nada.kth.se>
|
||||
|
||||
* boot-9.scm (ipow-by-squaring): Removed.
|
||||
(default-duplicate-binding-handler): Set default to
|
||||
'(replace warn last)
|
||||
|
||||
* boot-9.scm (module-make-local-var!): Use module-add!.
|
||||
(module-primitive-add!): New function.
|
||||
(resolve-interface): Use
|
||||
|
|
|
@ -153,18 +153,6 @@
|
|||
|
||||
|
||||
|
||||
;;; {Integer Math}
|
||||
;;;
|
||||
|
||||
(define (ipow-by-squaring x k acc proc)
|
||||
(cond ((zero? k) acc)
|
||||
((= 1 k) (proc acc x))
|
||||
(else (ipow-by-squaring (proc x x)
|
||||
(quotient k 2)
|
||||
(if (even? k) acc (proc acc x))
|
||||
proc))))
|
||||
|
||||
|
||||
;;; {Symbol Properties}
|
||||
;;;
|
||||
|
||||
|
@ -2916,7 +2904,7 @@
|
|||
(make-mutable-parameter #f))
|
||||
|
||||
(define default-duplicate-binding-handler
|
||||
(make-mutable-parameter '(replace warn-override-core check)
|
||||
(make-mutable-parameter '(replace warn last)
|
||||
(lambda (handler-names)
|
||||
(default-duplicate-binding-procedures
|
||||
(lookup-duplicates-handlers handler-names))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue