unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andreas Rottmann <a.rottmann@gmx.at>
To: Guile Development <guile-devel@gnu.org>
Subject: [PATCH] `import' should accept multiple clauses
Date: Sun, 06 Jun 2010 16:22:33 +0200	[thread overview]
Message-ID: <87bpbo44wm.fsf@delenn.lan> (raw)

[-- 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/>

             reply	other threads:[~2010-06-06 14:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-06 14:22 Andreas Rottmann [this message]
2010-06-09  6:48 ` [PATCH] `import' should accept multiple clauses Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bpbo44wm.fsf@delenn.lan \
    --to=a.rottmann@gmx.at \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).