[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
guile/guile-core NEWS
From: |
Thien-Thi Nguyen |
Subject: |
guile/guile-core NEWS |
Date: |
Sat, 25 Aug 2001 12:52:53 -0700 |
CVSROOT: /cvs
Module name: guile
Changes by: Thien-Thi Nguyen <address@hidden> 01/08/25 12:52:53
Modified files:
guile-core : NEWS
Log message:
Add news on `:select' and `:renamer' facilities.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/NEWS.diff?cvsroot=OldCVS&tr1=1.316&tr2=1.317&r1=text&r2=text
Patches:
Index: guile/guile-core/NEWS
diff -u guile/guile-core/NEWS:1.316 guile/guile-core/NEWS:1.317
--- guile/guile-core/NEWS:1.316 Sun Aug 12 12:19:41 2001
+++ guile/guile-core/NEWS Sat Aug 25 12:52:53 2001
@@ -383,6 +383,61 @@
`export'. The new `re-export' will not make copies of variables when
rexporting them, as `export' did wrongly.
+** Module system now allows selection and renaming of imported bindings
+
+Previously, when using `use-modules' or the `#:use-module' clause in
+the `define-module' form, all the bindings (association of symbols to
+values) for imported modules were added to the "current module" on an
+as-is basis. This has been changed to allow finer control through two
+new facilities: selection and renaming.
+
+You can now select which of the imported module's bindings are to be
+visible in the current module by using the `:select' clause. This
+clause also can be used to rename individual bindings. For example:
+
+ ;; import all bindings no questions asked
+ (use-modules (ice-9 common-list))
+
+ ;; import four bindings, renaming two of them;
+ ;; the current module sees: every some zonk-y zonk-n
+ (use-modules ((ice-9 common-list)
+ :select (every some
+ (remove-if . zonk-y)
+ (remove-if-not . zonk-n))))
+
+You can also programmatically rename all selected bindings using the
+`:renamer' clause, which specifies a proc that takes a symbol and
+returns another symbol. Because it is common practice to use a prefix,
+we now provide the convenience procedure `symbol-prefix-proc'. For
+example:
+
+ ;; import four bindings, renaming two of them specifically,
+ ;; and all four w/ prefix "CL:";
+ ;; the current module sees: CL:every CL:some CL:zonk-y CL:zonk-n
+ (use-modules ((ice-9 common-list)
+ :select (every some
+ (remove-if . zonk-y)
+ (remove-if-not . zonk-n))
+ :renamer (symbol-prefix-proc 'CL:)))
+
+ ;; import four bindings, renaming two of them specifically,
+ ;; and all four by upcasing.
+ ;; the current module sees: EVERY SOME ZONK-Y ZONK-N
+ (define (upcase-symbol sym)
+ (string->symbol (string-upcase (symbol->string sym))))
+
+ (use-modules ((ice-9 common-list)
+ :select (every some
+ (remove-if . zonk-y)
+ (remove-if-not . zonk-n))
+ :renamer upcase-symbol))
+
+Note that programmatic renaming is done *after* individual renaming.
+Also, the above examples show `use-modules', but the same facilities are
+available for the `#:use-module' clause of `define-module'.
+
+See manual for more info.
+
** The semantics of guardians have changed.
The changes are for the most part compatible. An important criterion
- guile/guile-core NEWS, Thien-Thi Nguyen, 2001/08/02
- guile/guile-core NEWS, Thien-Thi Nguyen, 2001/08/02
- guile/guile-core NEWS, Marius Vollmer, 2001/08/07
- guile/guile-core NEWS, Marius Vollmer, 2001/08/07
- guile/guile-core NEWS, Thien-Thi Nguyen, 2001/08/12
- guile/guile-core NEWS, Thien-Thi Nguyen, 2001/08/12
- guile/guile-core NEWS,
Thien-Thi Nguyen <=
- guile/guile-core NEWS, Thien-Thi Nguyen, 2001/08/25