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.0-97-gb075a6


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.0-97-gb075a6d
Date: Fri, 11 Mar 2011 20:02:44 +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=b075a6d766c2ffe7c575b63648d8ae0d51b5dd3a

The branch, stable-2.0 has been updated
       via  b075a6d766c2ffe7c575b63648d8ae0d51b5dd3a (commit)
      from  bfb85df7084e26a276142cdc62315a85c7a0ba20 (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 b075a6d766c2ffe7c575b63648d8ae0d51b5dd3a
Author: Ludovic Courtès <address@hidden>
Date:   Fri Mar 11 21:01:35 2011 +0100

    Fix `define-inlinable' in SRFI-9 so that arguments are evaluated only once.
    
    * module/srfi/srfi-9.scm (define-inlinable): When inlining, evaluate the
      arguments only once.  Reported by Andreas Rottmann; thanks to Andy
      Wingo for the elegant solution.
    
    * test-suite/tests/srfi-9.test ("side-effecting arguments"): New test
      prefix.

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

Summary of changes:
 module/srfi/srfi-9.scm       |    9 ++++++---
 test-suite/tests/srfi-9.test |    9 ++++++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/module/srfi/srfi-9.scm b/module/srfi/srfi-9.scm
index fad570b..f9449a6 100644
--- a/module/srfi/srfi-9.scm
+++ b/module/srfi/srfi-9.scm
@@ -80,15 +80,18 @@
     (syntax-case x ()
       ((_ (name formals ...) body ...)
        (identifier? #'name)
-       (with-syntax ((proc-name (make-procedure-name #'name)))
+       (with-syntax ((proc-name  (make-procedure-name #'name))
+                     ((args ...) (generate-temporaries #'(formals ...))))
          #`(begin
              (define (proc-name formals ...)
                body ...)
              (define-syntax name
                (lambda (x)
                  (syntax-case x ()
-                   ((_ formals ...)
-                    #'(begin body ...))
+                   ((_ args ...)
+                    #'((lambda (formals ...)
+                         body ...)
+                       args ...))
                    (_
                     (identifier? x)
                     #'proc-name))))))))))
diff --git a/test-suite/tests/srfi-9.test b/test-suite/tests/srfi-9.test
index f8006c4..f26a7a2 100644
--- a/test-suite/tests/srfi-9.test
+++ b/test-suite/tests/srfi-9.test
@@ -94,8 +94,15 @@
   (pass-if-exception "set-y! on bar" exception:wrong-type-arg
      (set-y! b 99)))
 
+(with-test-prefix "side-effecting arguments"
+
+  (pass-if "predicate"
+    (let ((x 0))
+      (and (foo? (begin (set! x (+ x 1)) f))
+           (= x 1)))))
+
 (with-test-prefix "non-toplevel"
-    
+
   (define-record-type :frotz (make-frotz a b) frotz?
     (a frotz-a) (b frotz-b set-frotz-b!))
 


hooks/post-receive
-- 
GNU Guile



reply via email to

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