guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Two r6rs bugs


From: Ian Price
Subject: Re: Two r6rs bugs
Date: Sun, 25 Nov 2012 12:30:29 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Mark H Weaver <address@hidden> writes:

> Instead of using 'null?' and 'cdr' on the syntax object, can you please
> rework this to use 'syntax-case'?  I.e. instead of (if (null? ...) ...)
> do this:
>
>   (syntax-case #'(rest ...) ()
>     (() <null-case>)
>     ((name rest ...) <non-null-case>))
>
> What do you think?

Yes, that would be much better. It's startling how often I forget I can
syntax-case this way.

Changed, okay for me to push?

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"

>From 5d7c55bdcffbc326e775b0b9c881a01e44eee160 Mon Sep 17 00:00:00 2001
From: Ian Price <address@hidden>
Date: Sun, 25 Nov 2012 12:28:41 +0000
Subject: [PATCH] R6RS srfi library names should ignore first identifier after
 the :n

* module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface):
  (srfi :n name ids ...) -> (srfi srfi-n ids ...)
* test-suite/tests/rnrs-libraries.test ("srfi"): Add test.
---
 module/ice-9/r6rs-libraries.scm      |    8 +++++++-
 test-suite/tests/rnrs-libraries.test |    4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/module/ice-9/r6rs-libraries.scm b/module/ice-9/r6rs-libraries.scm
index 019a6a7..428d951 100644
--- a/module/ice-9/r6rs-libraries.scm
+++ b/module/ice-9/r6rs-libraries.scm
@@ -40,7 +40,13 @@
                      (substring (symbol->string (syntax->datum #'colon-n))
                                 1)))))
        (resolve-r6rs-interface
-        #`(library (srfi #,srfi-n rest ... (version ...))))))
+        (syntax-case #'(rest ...) ()
+          (()
+           #`(library (srfi #,srfi-n (version ...))))
+          ((name rest ...)
+           ;; SRFI 97 says that the first identifier after the colon-n
+           ;; is used for the libraries name, so it must be ignored.
+           #`(library (srfi #,srfi-n rest ... (version ...))))))))
     
     ((library (name name* ... (version ...)))
      (and-map sym? #'(name name* ...))
diff --git a/test-suite/tests/rnrs-libraries.test 
b/test-suite/tests/rnrs-libraries.test
index e961c28..9add98a 100644
--- a/test-suite/tests/rnrs-libraries.test
+++ b/test-suite/tests/rnrs-libraries.test
@@ -183,7 +183,9 @@
   (with-test-prefix "srfi"
     (pass-if "renaming works"
       (eq? (resolve-interface '(srfi srfi-1))
-           (resolve-r6rs-interface '(srfi :1)))))
+           (resolve-r6rs-interface '(srfi :1)))
+      (eq? (resolve-interface '(srfi srfi-1))
+           (resolve-r6rs-interface '(srfi :1 lists)))))
 
   (with-test-prefix "macro"
     (pass-if "multiple clauses"
-- 
1.7.7.6


reply via email to

[Prev in Thread] Current Thread [Next in Thread]