summaryrefslogtreecommitdiff
path: root/lang/elisp/transform.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-04-25 19:09:19 +0200
committerAndy Wingo <wingo@pobox.com>2009-04-25 19:09:19 +0200
commit39f30ea29df55eda3f92d0cf68f1f89282a1418e (patch)
tree761b29bb45c91881c8358b51bab8d368c122458e /lang/elisp/transform.scm
parent97ce9dbf2158a08980189bcb3c3016ba30246829 (diff)
downloadguile-39f30ea29df55eda3f92d0cf68f1f89282a1418e.tar.gz
Fix the elisp memoizer code for syncase-in-boot-9
* lang/elisp/interface.scm: * lang/elisp/internals/lambda.scm: * lang/elisp/primitives/syntax.scm: * lang/elisp/transform.scm: Use (lang elisp expand) as the transformer, because we really are intending this code for the memoizer and not the compiler. * lang/elisp/expand.scm: A null expander. * lang/elisp/interface.scm (use-elisp-file, use-elisp-library): * lang/elisp/transform.scm (scheme): Turn these defmacros into procedure->memoizing-macro calls, given that without syncase we have no defmacro either. * lang/elisp/primitives/fns.scm (macroexpand): Comment out, as Scheme's macro expander (temporarily on hiatus) won't work with elisp.
Diffstat (limited to 'lang/elisp/transform.scm')
-rw-r--r--lang/elisp/transform.scm39
1 files changed, 22 insertions, 17 deletions
diff --git a/lang/elisp/transform.scm b/lang/elisp/transform.scm
index ee288a722..09159c073 100644
--- a/lang/elisp/transform.scm
+++ b/lang/elisp/transform.scm
@@ -1,4 +1,5 @@
(define-module (lang elisp transform)
+ #:use-syntax (lang elisp expand)
#:use-module (lang elisp internals trace)
#:use-module (lang elisp internals fset)
#:use-module (lang elisp internals evaluation)
@@ -26,23 +27,27 @@
(define (syntax-error x)
(error "Syntax error in expression" x))
-(define-macro (scheme exp . module)
- (let ((m (if (null? module)
- the-root-module
- (save-module-excursion
- (lambda ()
- ;; In order for `resolve-module' to work as
- ;; expected, the current module must contain the
- ;; `app' variable. This is not true for #:pure
- ;; modules, specifically (lang elisp base). So,
- ;; switch to the root module (guile) before calling
- ;; resolve-module.
- (set-current-module the-root-module)
- (resolve-module (car module)))))))
- (let ((x `(,eval (,quote ,exp) ,m)))
- ;;(write x)
- ;;(newline)
- x)))
+(define scheme
+ (procedure->memoizing-macro
+ (lambda (exp env)
+ (let ((exp (cadr exp))
+ (module (cddr exp)))
+ (let ((m (if (null? module)
+ the-root-module
+ (save-module-excursion
+ (lambda ()
+ ;; In order for `resolve-module' to work as
+ ;; expected, the current module must contain the
+ ;; `app' variable. This is not true for #:pure
+ ;; modules, specifically (lang elisp base). So,
+ ;; switch to the root module (guile) before calling
+ ;; resolve-module.
+ (set-current-module the-root-module)
+ (resolve-module (car module)))))))
+ (let ((x `(,eval (,quote ,exp) ,m)))
+ ;;(write x)
+ ;;(newline)
+ x))))))
(define (transformer x)
(cond ((pair? x)