summaryrefslogtreecommitdiff
path: root/module/srfi
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2011-03-11 21:01:35 +0100
committerLudovic Courtès <ludo@gnu.org>2011-03-11 21:02:30 +0100
commitb075a6d766c2ffe7c575b63648d8ae0d51b5dd3a (patch)
tree222bd6b808ec0ee20048d8266ec2343006806ce4 /module/srfi
parentbfb85df7084e26a276142cdc62315a85c7a0ba20 (diff)
downloadguile-b075a6d766c2ffe7c575b63648d8ae0d51b5dd3a.tar.gz
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.
Diffstat (limited to 'module/srfi')
-rw-r--r--module/srfi/srfi-9.scm9
1 files changed, 6 insertions, 3 deletions
diff --git a/module/srfi/srfi-9.scm b/module/srfi/srfi-9.scm
index fad570b26..f9449a66f 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))))))))))