From 756b1dfa6e96684e839077d7f800ca227b88c33a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 27 Apr 2011 22:26:05 +0200 Subject: [PATCH] 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. --- module/srfi/srfi-9.scm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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 +;; . + +(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)