X-Git-Url: https://git.hcoop.net/bpt/guile.git/blobdiff_plain/f595ccfefc8461eb49e1a02c8974bc4e2575a502..fe6ee0528b08d48a8305dc6809e09dac97060118:/NEWS?ds=sidebyside diff --git a/NEWS b/NEWS index 0d1bd795e..bac814d1b 100644 --- a/NEWS +++ b/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 - (default-module-duplicates-handler 'last) + 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). -in your .guile init file. +If you want the old behavior back without replacements or warnings you +can add the line: + + (default-duplicate-binding-handler 'last) + +to your .guile init file. The syntax for the :duplicates option is: @@ -95,14 +104,24 @@ 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) + +These two are provided by the (oop goops) module: + merge-generics merge generic functions with a common name into an + merge-accessors merge accessors with a common name 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 @@ -112,6 +131,17 @@ replacement. A typical example is `format' in (ice-9 format) which is a replacement for the core binding `format'. +** Adding prefixes to imported bindings in the module system + +There is now a new :use-module option :prefix. It can be used to add +a prefix to all imported bindings. + + (define-module (foo) + :use-module ((bar) :prefix bar:)) + +will import all bindings exported from bar, but rename them by adding +the prefix `bar:'. + ** Merging generic functions It is sometimes tempting to use GOOPS accessors with short names.