From d1c934cb1f9cc9da9410874ec0c81742106dc7c8 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 5 Sep 2010 18:23:04 +0000 Subject: [PATCH] Work around bug that makes DECLARE and SYNTAX-RULES not mix. --- src/runtime/mit-syntax.scm | 4 ++-- src/runtime/syntax-declaration.scm | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/runtime/mit-syntax.scm b/src/runtime/mit-syntax.scm index 79fa16a1a..478122779 100644 --- a/src/runtime/mit-syntax.scm +++ b/src/runtime/mit-syntax.scm @@ -344,13 +344,13 @@ USA. (define (classifier:declare form environment definition-environment) definition-environment - (syntax-check '(KEYWORD * (SYMBOL * DATUM)) form) + (syntax-check '(KEYWORD * (IDENTIFIER * DATUM)) form) (make-declaration-item (lambda () (classify/declarations (cdr form) environment)))) (define (classifier:local-declare form environment definition-environment) - (syntax-check '(KEYWORD (* (SYMBOL * DATUM)) + FORM) form) + (syntax-check '(KEYWORD (* (IDENTIFIER * DATUM)) + FORM) form) (let ((body (classify/body (cddr form) environment diff --git a/src/runtime/syntax-declaration.scm b/src/runtime/syntax-declaration.scm index 19e4bdac5..f1cbbecc3 100644 --- a/src/runtime/syntax-declaration.scm +++ b/src/runtime/syntax-declaration.scm @@ -41,7 +41,14 @@ USA. (define (map-declaration-identifiers procedure declaration) (if (not (pair? declaration)) (error "Ill-formed declaration:" declaration)) - (let ((entry (assq (car declaration) known-declarations))) + (let* ((declaration + ;++ This is a kludge -- rather than strip syntactic closures, + ;++ it should be aware of the environment. + (if (symbol? (car declaration)) + declaration + (cons (strip-syntactic-closures (car declaration)) + (cdr declaration)))) + (entry (assq (car declaration) known-declarations))) (if (and entry (syntax-match? (cadr entry) (cdr declaration))) ((cddr entry) declaration procedure) (begin -- 2.25.1