Document that we support srfi-46 and add it to %cond-expand-features.
authorMark H Weaver <mhw@netris.org>
Wed, 15 Jan 2014 08:08:32 +0000 (03:08 -0500)
committerMark H Weaver <mhw@netris.org>
Wed, 15 Jan 2014 08:21:07 +0000 (03:21 -0500)
* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-46.

* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-46 to the list of core
  features.
  (SRFI-46): New node.

* doc/ref/api-macros.texi (Syntax Rules): Mention that the custom
  ellipsis identifier support is specified by SRFI-46.

* test-suite/tests/syntax.test ("syntax-rules"): Add ellipsis hygiene
  test from SRFI-46.

doc/ref/api-macros.texi
doc/ref/srfi-modules.texi
module/ice-9/boot-9.scm
test-suite/tests/syntax.test

index 030daed..acfbc65 100644 (file)
@@ -1,7 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
-@c Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 2010, 2011, 2012, 2013
-@c   Free Software Foundation, Inc.
+@c Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 2010, 2011,
+@c   2012, 2013, 2014 Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
 @node Macros
@@ -392,7 +392,7 @@ templates.  For example:
 When writing macros that generate macro definitions, it is convenient to
 use a different ellipsis identifier at each level.  Guile allows the
 desired ellipsis identifier to be specified as the first operand to
-@code{syntax-rules}, as per R7RS.  For example:
+@code{syntax-rules}, as specified by SRFI-46 and R7RS.  For example:
 
 @example
 (define-syntax define-quotation-macros
index 6f1ed05..66d5bd1 100644 (file)
@@ -48,6 +48,7 @@ get the relevant SRFI documents from the SRFI home page
 * SRFI-41::                     Streams.
 * SRFI-42::                     Eager comprehensions
 * SRFI-45::                     Primitives for expressing iterative lazy algorithms
+* SRFI-46::                     Basic syntax-rules Extensions.
 * SRFI-55::                     Requiring Features.
 * SRFI-60::                     Integers as bits.
 * SRFI-61::                     A more general `cond' clause
@@ -154,6 +155,7 @@ srfi-16
 srfi-23
 srfi-30
 srfi-39
+srfi-46
 srfi-55
 srfi-61
 srfi-62
@@ -4658,6 +4660,15 @@ apply @code{force} to arguments of deconstructors (e.g., @code{car},
 wrap procedure bodies with @code{(lazy ...)}.
 @end itemize
 
+@node SRFI-46
+@subsection SRFI-46 Basic syntax-rules Extensions
+@cindex SRFI-46
+
+Guile's core @code{syntax-rules} supports the extensions specified by
+SRFI-46/R7RS.  Tail patterns have been supported since at least Guile
+2.0, and custom ellipsis identifiers have been supported since Guile
+2.0.10.  @xref{Syntax Rules}.
+
 @node SRFI-55
 @subsection SRFI-55 - Requiring Features
 @cindex SRFI-55
index 640229e..e4b3b58 100644 (file)
@@ -4041,6 +4041,7 @@ when none is available, reading FILE-NAME with READER."
     srfi-23  ;; `error` procedure
     srfi-30  ;; nested multi-line comments
     srfi-39  ;; parameterize
+    srfi-46  ;; basic syntax-rules extensions
     srfi-55  ;; require-extension
     srfi-61  ;; general cond clause
     srfi-62  ;; s-expression comments
index 5c2a703..a1129e9 100644 (file)
@@ -1,7 +1,7 @@
 ;;;; syntax.test --- test suite for Guile's syntactic forms    -*- scheme -*-
 ;;;;
 ;;;; Copyright (C) 2001, 2003, 2004, 2005, 2006, 2009, 2010,
-;;;;   2011, 2012, 2013 Free Software Foundation, Inc.
+;;;;   2011, 2012, 2013, 2014 Free Software Foundation, Inc.
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
               '((((x y) …) ...)
                 (((x y) ...) …)))))))
       (define-syntax bar (foo x y z))
-      (bar a b c))))
+      (bar a b c)))
+
+  ;; This test is given in SRFI-46.
+  (pass-if-equal "custom ellipsis is handled hygienically"
+      '((1) 2 (3) (4))
+    (let-syntax
+        ((f (syntax-rules ()
+              ((f ?e)
+               (let-syntax
+                   ((g (syntax-rules --- ()
+                         ((g (??x ?e) (??y ---))
+                          '((??x) ?e (??y) ---)))))
+                 (g (1 2) (3 4)))))))
+      (f ---))))
 
 (with-test-prefix "syntax-error"