From e1d33d94bd24d5b2580df045f8193f6691f5d8a2 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 28 Jan 2018 16:47:12 -0800 Subject: [PATCH] Change define-bundle-interface to use quote-identifier. --- src/runtime/mit-macros.scm | 70 +++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 39 deletions(-) diff --git a/src/runtime/mit-macros.scm b/src/runtime/mit-macros.scm index 34f513203..3d3f09cd7 100644 --- a/src/runtime/mit-macros.scm +++ b/src/runtime/mit-macros.scm @@ -766,52 +766,44 @@ USA. (begin form ...))))) (define-syntax :define-bundle-interface - (er-macro-transformer - (lambda (form rename compare) - (declare (ignore compare)) + (sc-macro-transformer + (lambda (form use-env) (syntax-check '(_ identifier identifier identifier * (or symbol (symbol * (symbol * expression)))) form) - (make-interface-helper rename - (cadr form) - (caddr form) - (cadddr form) + (make-interface-helper (close-syntax (cadr form) use-env) + (close-syntax (caddr form) use-env) + (close-syntax (cadddr form) use-env) (cddddr form))))) -(define (make-interface-helper rename interface constructor capturer elements) - (let ((rlist (rename 'list))) - `(,(rename 'begin) - (,(rename 'define) - ,interface - (,(rename 'make-bundle-interface) +(define (make-interface-helper interface constructor capturer elements) + `(begin + (define ,interface + (make-bundle-interface ',(let* ((name (identifier->symbol interface)) (s (symbol->string name))) (if (string-suffix? "?" s) (string->symbol (string-head s (fix:- (string-length s) 1))) name)) - (,rlist ,@(map (lambda (element) - (if (symbol? element) - `(,rlist ',element) - `(,rlist ',(car element) - ,@(map (lambda (p) - `(,rlist ',(car p) ,@(cdr p))) - (cdr element))))) - elements)))) - (,(rename 'define) - ,constructor - (,(rename 'bundle-constructor) ,interface)) - (,(rename 'define-syntax) - ,capturer - (,(rename 'sc-macro-transformer) - (,(rename 'lambda) - (form use-env) - (if (,(rename 'not) (,(rename 'null?) (,(rename 'cdr) form))) - (,(rename 'syntax-error) "Ill-formed special form:" form)) - (,rlist ',constructor - ,@(map (lambda (element) - `(,(rename 'close-syntax) - ',(if (symbol? element) - element - (car element)) - use-env)) - elements)))))))) \ No newline at end of file + (list ,@(map (lambda (element) + (if (symbol? element) + `',element + `(list ',(car element) + ,@(map (lambda (p) + `(list ',(car p) ,@(cdr p))) + (cdr element))))) + elements)))) + (define ,constructor + (bundle-constructor ,interface)) + (define-syntax ,capturer + (sc-macro-transformer + (lambda (form use-env) + (syntax-check '(_) form) + (list (quote-identifier ,constructor) + ,@(map (lambda (element) + `(close-syntax + ',(if (symbol? element) + element + (car element)) + use-env)) + elements))))))) \ No newline at end of file -- 2.25.1