guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-115-g866ec


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-115-g866ecf5
Date: Sun, 08 Jan 2012 13:37:17 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=866ecf54c04c2b841f40f3a02814eeba6aeb4dee

The branch, stable-2.0 has been updated
       via  866ecf54c04c2b841f40f3a02814eeba6aeb4dee (commit)
       via  4f5fb3519471a7e1e520c3cc39e7853f4170349e (commit)
       via  729b62bd95c61b6e2992f823b469b76bdc483b0d (commit)
      from  49d09292ac6d92a86b574478a69450b85d2dd8c1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 866ecf54c04c2b841f40f3a02814eeba6aeb4dee
Author: Andy Wingo <address@hidden>
Date:   Sun Jan 8 14:36:17 2012 +0100

    syntax parameters doc formatting
    
    * doc/ref/api-macros.texi (Syntax Parameters): Some copy-editing on
      Ian's lovely syntax-parameters documentation.

commit 4f5fb3519471a7e1e520c3cc39e7853f4170349e
Author: Andy Wingo <address@hidden>
Date:   Sun Jan 8 14:27:03 2012 +0100

    deprecate SCM_ASRTGO
    
    * libguile/deprecated.h: Mark scm_immutable_cell and
      scm_immutable_double_cell as being SCM_DEPRECATED, not SCM_API.
      Deprecate SCM_ASRTGO.
    
    * libguile/deprecated.c (scm_i_deprecated_asrtgo): New support
      procedure.
    
    * doc/ref/api-control.texi (Handling Errors): Remove ASRTGO docs.

commit 729b62bd95c61b6e2992f823b469b76bdc483b0d
Author: Ian Price <address@hidden>
Date:   Sat Jan 7 01:59:33 2012 +0000

    document syntax parameters
    
    * doc/ref/api-macros.texi (Macros): Add subsection for "Syntax Parameters"

-----------------------------------------------------------------------

Summary of changes:
 doc/ref/api-control.texi |   10 +-----
 doc/ref/api-macros.texi  |   78 +++++++++++++++++++++++++++++++++++++++++++++-
 libguile/deprecated.c    |   12 +++++++
 libguile/deprecated.h    |   14 ++++++--
 4 files changed, 101 insertions(+), 13 deletions(-)

diff --git a/doc/ref/api-control.texi b/doc/ref/api-control.texi
index 957b9a7..c1502b0 100644
--- a/doc/ref/api-control.texi
+++ b/doc/ref/api-control.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 
2010, 2011
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 
2010, 2011, 2012
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -1712,14 +1712,6 @@ leave it unspecified which argument's type is incorrect. 
 Again,
 @code{SCM_ARGn} should be preferred over a raw zero constant.
 @end deftypefn
 
-The @code{SCM_ASRTGO} macro provides another strategy for handling 
-incorrect types.
-
address@hidden Macro void SCM_ASRTGO (int @var{test}, label)
-If @var{test} is zero, use @code{goto} to jump to the given @var{label}.
address@hidden must appear within the current function.
address@hidden deftypefn
-
 @node Continuation Barriers
 @subsection Continuation Barriers
 
diff --git a/doc/ref/api-macros.texi b/doc/ref/api-macros.texi
index 92816ad..e60864b 100644
--- a/doc/ref/api-macros.texi
+++ b/doc/ref/api-macros.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 
2010, 2011
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 
2010, 2011, 2012
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -40,6 +40,7 @@ languages}, or EDSLs.}.
 * Syntax Case::                 Procedural, hygienic macros.
 * Defmacros::                   Lisp-style macros.
 * Identifier Macros::           Identifier macros.
+* Syntax Parameters::           Syntax Parameters
 * Eval When::                   Affecting the expand-time environment.
 * Internal Macros::             Macros as first-class values.
 @end menu
@@ -861,6 +862,81 @@ wrapping in @code{#'} syntax forms.
 @end deffn
 
 
address@hidden Syntax Parameters
address@hidden Syntax Parameters
+
+Syntax address@hidden in the paper @cite{Keeping it Clean
+with Syntax Parameters} by Barzilay, Culpepper and Flatt.} are a
+mechanism for rebinding a macro definition within the dynamic extent of
+a macro expansion.  This provides a convenient solution to one of the
+most common types of unhygienic macro: those that introduce a unhygienic
+binding each time the macro is used.  Examples include a @code{lambda}
+form with a @code{return} keyword, or class macros that introduce a
+special @code{self} binding.
+
+With syntax parameters, instead of introducing the binding
+unhygienically each time, we instead create one binding for the keyword,
+which we can then adjust later when we want the keyword to have a
+different meaning.  As no new bindings are introduced, hygiene is
+preserved. This is similar to the dynamic binding mechanisms we have at
+run-time (@pxref{SRFI-39, parameters}), except that the dynamic binding
+only occurs during macro expansion.  The code after macro expansion
+remains lexically scoped.
+
address@hidden {Syntax} define-syntax-parameter keyword transformer
+Binds @var{keyword} to the value obtained by evaluating
address@hidden  The @var{transformer} provides the default expansion
+for the syntax parameter, and in the absence of
address@hidden, is functionally equivalent to
address@hidden  Usually, you will just want to have the
address@hidden throw a syntax error indicating that the @var{keyword}
+is supposed to be used in conjunction with another macro, for example:
address@hidden
+(define-syntax-parameter return
+  (lambda (stx)
+    (syntax-violation 'return "return used outside of a lambda^" stx)))
address@hidden example
address@hidden deffn
+
address@hidden {Syntax} syntax-parameterize ((keyword transformer) @dots{}) exp 
@dots{}
+Adjusts @var{keyword} @dots{} to use the values obtained by evaluating
+their @var{transformer} @dots{}, in the expansion of the @var{exp}
address@hidden forms.  Each @var{keyword} must be bound to a syntax-parameter.
address@hidden differs from @code{let-syntax}, in that the
+binding is not shadowed, but adjusted, and so uses of the keyword in the
+expansion of @var{exp} @dots{} use the new transformers. This is
+somewhat similar to how @code{parameterize} adjusts the values of
+regular parameters, rather than creating new bindings.
+
address@hidden
+(define-syntax lambda^
+  (syntax-rules ()
+    [(lambda^ argument-list body body* ...)
+     (lambda argument-list
+       (call-with-current-continuation
+        (lambda (escape)
+          ;; In the body we adjust the 'return' keyword so that calls
+          ;; to 'return' are replaced with calls to the escape
+          ;; continuation.
+          (syntax-parameterize ([return (syntax-rules ()
+                                          [(return vals (... ...))
+                                           (escape vals (... ...))])])
+            body body* ...))))]))
+
+;; Now we can write functions that return early.  Here, 'product' will
+;; return immediately if it sees any 0 element.
+(define product
+  (lambda^ (list)
+           (fold (lambda (n o)
+                   (if (zero? n)
+                       (return 0)
+                       (* n o)))
+                 1
+                 list)))
address@hidden example
address@hidden deffn
+
+
 @node Eval When
 @subsection Eval-when
 
diff --git a/libguile/deprecated.c b/libguile/deprecated.c
index 4ba305e..530d2d4 100644
--- a/libguile/deprecated.c
+++ b/libguile/deprecated.c
@@ -2624,6 +2624,18 @@ scm_immutable_double_cell (scm_t_bits car, scm_t_bits 
cbr,
   return scm_double_cell (car, cbr, ccr, cdr);
 }
 
+
+
+
+scm_t_bits
+scm_i_deprecated_asrtgo (scm_t_bits condition)
+{
+  scm_c_issue_deprecation_warning
+    ("SCM_ASRTGO is deprecated.  Use `if (!condition) goto label;' directly.");
+
+  return condition;
+}
+
 
 
 
diff --git a/libguile/deprecated.h b/libguile/deprecated.h
index 82415ea..ed81344 100644
--- a/libguile/deprecated.h
+++ b/libguile/deprecated.h
@@ -5,7 +5,7 @@
 #ifndef SCM_DEPRECATED_H
 #define SCM_DEPRECATED_H
 
-/* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009, 2010, 2011 Free Software 
Foundation, Inc.
+/* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 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 License
@@ -796,12 +796,20 @@ SCM_DEPRECATED SCM scm_struct_create_handle (SCM obj);
 
 /* Deprecated 26-05-2011, as the GC_STUBBORN API doesn't do anything any
    more.  */
-SCM_API SCM scm_immutable_cell (scm_t_bits car, scm_t_bits cdr);
-SCM_API SCM scm_immutable_double_cell (scm_t_bits car, scm_t_bits cbr,
+SCM_DEPRECATED SCM scm_immutable_cell (scm_t_bits car, scm_t_bits cdr);
+SCM_DEPRECATED SCM scm_immutable_double_cell (scm_t_bits car, scm_t_bits cbr,
                                       scm_t_bits ccr, scm_t_bits cdr);
 
 
 
+SCM_DEPRECATED SCM scm_i_deprecated_asrtgo (scm_t_bits condition);
+
+/* Deprecated 08-01-2012, as it's undocumented and unused.  */
+#define SCM_ASRTGO(_cond, _label)              \
+  do { if (!scm_i_deprecated_asrtgo(_cond)) goto _label; } while (0)
+
+
+
 void scm_i_init_deprecated (void);
 
 #endif


hooks/post-receive
-- 
GNU Guile



reply via email to

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