summaryrefslogtreecommitdiff
path: root/module/srfi
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2011-04-27 22:26:05 +0200
committerLudovic Courtès <ludo@gnu.org>2011-04-27 22:26:05 +0200
commit756b1dfa6e96684e839077d7f800ca227b88c33a (patch)
treef56e25889339b4e94bc70745f11a5566988000f8 /module/srfi
parentde424d959442e6be066fb8fa048253a4e5b2bb45 (diff)
downloadguile-756b1dfa6e96684e839077d7f800ca227b88c33a.tar.gz
Keep a 2.0.0-compatible `define-inlinable' macro in (srfi srfi-9).
Partially reverts 165b10ddfaaa8ecc72d45a9be7d29e7537dc2379 and 531c9f1dc51c4801c4d031ee80a31f15285a6b85. * module/srfi/srfi-9.scm (define-inlinable): New macro.
Diffstat (limited to 'module/srfi')
-rw-r--r--module/srfi/srfi-9.scm31
1 files changed, 31 insertions, 0 deletions
diff --git a/module/srfi/srfi-9.scm b/module/srfi/srfi-9.scm
index ad9e95de1..6574a8da7 100644
--- a/module/srfi/srfi-9.scm
+++ b/module/srfi/srfi-9.scm
@@ -64,6 +64,37 @@
(cond-expand-provide (current-module) '(srfi-9))
+;; Roll our own instead of using the public `define-inlinable'. This is
+;; because the public one has a different `make-procedure-name', so
+;; using it would require users to recompile code that uses SRFI-9. See
+;; <http://lists.gnu.org/archive/html/guile-devel/2011-04/msg00111.html>.
+
+(define-syntax define-inlinable
+ (lambda (x)
+ (define (make-procedure-name name)
+ (datum->syntax name
+ (symbol-append '% (syntax->datum name)
+ '-procedure)))
+
+ (syntax-case x ()
+ ((_ (name formals ...) body ...)
+ (identifier? #'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 ()
+ ((_ args ...)
+ #'((lambda (formals ...)
+ body ...)
+ args ...))
+ (_
+ (identifier? x)
+ #'proc-name))))))))))
+
(define-syntax define-record-type
(lambda (x)
(define (field-identifiers field-specs)