diff --git a/module/language/ghil/compile-glil.scm b/module/language/ghil/compile-glil.scm index 2034ca045..bad338005 100644 --- a/module/language/ghil/compile-glil.scm +++ b/module/language/ghil/compile-glil.scm @@ -45,6 +45,10 @@ (ghil-env-add! parent-env v)) (ghil-env-variables env)))) +;; The premise of this, unused, approach to optimization is that you can +;; determine the environment of a variable lexically, because they have +;; been alpha-renamed. It makes the transformations *much* easier. +;; Unfortunately it doesn't work yet. (define (optimize* x) (transform-record ( env loc) x ((quasiquote exp) diff --git a/module/system/base/syntax.scm b/module/system/base/syntax.scm index d0d45aaf4..d968bdff8 100644 --- a/module/system/base/syntax.scm +++ b/module/system/base/syntax.scm @@ -272,13 +272,15 @@ (let ((record-type (symbol-append '< (make-stem stem) '>))) `((and (eq? ,rtd ,record-type) ,@(reverse (further-predicates r stem slots))) - (let ,(reverse (let-clauses r stem (append (cdr type-and-common) - slots))) + (let ,(reverse (let-clauses r stem slots)) ,@(if (pair? body) (map transform-expr body) '((if #f #f))))))))) `(let* ((,r ,record) - (,rtd (struct-vtable ,r))) + (,rtd (struct-vtable ,r)) + ,@(map (lambda (slot) + `(,slot (,(make-stem slot) ,r))) + (cdr type-and-common))) (cond ,@(let ((clauses (map process-clause clauses))) (if (assq 'else clauses) clauses