unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] `import' should accept multiple clauses
@ 2010-06-06 14:22 Andreas Rottmann
  2010-06-09  6:48 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Rottmann @ 2010-06-06 14:22 UTC (permalink / raw)
  To: Guile Development

[-- Attachment #1: Type: text/plain, Size: 166 bytes --]

Hi!

Currently, R6RS `import' only accepts a single library reference; for
example `(import (rnrs base) (rnrs programs))' fails. The attached patch
should fix this.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: +import-multiple.patch --]
[-- Type: text/x-diff, Size: 1286 bytes --]

diff --git a/module/ice-9/r6rs-libraries.scm b/module/ice-9/r6rs-libraries.scm
index 56d4300..482f826 100644
--- a/module/ice-9/r6rs-libraries.scm
+++ b/module/ice-9/r6rs-libraries.scm
@@ -190,13 +190,19 @@
     
 (define-syntax import
   (lambda (stx)
-    (syntax-case stx (for)
-      ((_ (for import-set import-level ...))
-       #'(import import-set))
-      ((_ import-set)
-       #'(eval-when (eval load compile expand)
-           (let ((iface (resolve-r6rs-interface 'import-set)))
-             (call-with-deferred-observers
-              (lambda ()
-                (module-use-interfaces! (current-module) (list iface))))
+    (define (strip-for import-set)
+      (syntax-case import-set (for)
+        ((for import-set import-level ...)
+         #'import-set)
+        (import-set
+         #'import-set)))
+    (syntax-case stx ()
+      ((_ import-set ...)
+       (with-syntax (((library-reference ...) (map strip-for #'(import-set ...))))
+         #'(eval-when (eval load compile expand)
+             (let ((iface (resolve-r6rs-interface 'library-reference)))
+               (call-with-deferred-observers
+                 (lambda ()
+                   (module-use-interfaces! (current-module) (list iface)))))
+             ...
              (if #f #f)))))))

[-- Attachment #3: Type: text/plain, Size: 63 bytes --]


Regards, Rotty
-- 
Andreas Rottmann -- <http://rotty.yi.org/>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] `import' should accept multiple clauses
  2010-06-06 14:22 [PATCH] `import' should accept multiple clauses Andreas Rottmann
@ 2010-06-09  6:48 ` Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2010-06-09  6:48 UTC (permalink / raw)
  To: Andreas Rottmann; +Cc: Guile Development

On Sun 06 Jun 2010 16:22, Andreas Rottmann <a.rottmann@gmx.at> writes:

> Currently, R6RS `import' only accepts a single library reference; for
> example `(import (rnrs base) (rnrs programs))' fails. The attached patch
> should fix this.

Applied, thanks. If you don't mind, in the future please send patches in
the git-format-patch format :)

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-09  6:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-06 14:22 [PATCH] `import' should accept multiple clauses Andreas Rottmann
2010-06-09  6:48 ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).