From 807e70824a4637e852002514b8fe138aaf2831d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Sun, 5 May 2013 20:35:06 +0100 Subject: [PATCH] Move *MAGIC-UNQUOTE-MARKER* back to compiler.lisp --- jscl.lisp | 18 ------------------ src/compiler.lisp | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/jscl.lisp b/jscl.lisp index 03654ed..e75e959 100644 --- a/jscl.lisp +++ b/jscl.lisp @@ -43,24 +43,6 @@ (make-pathname :type type :directory directory :defaults defaults) (make-pathname :directory directory :defaults defaults))) -;;; BOOTSTRAP MAGIC: We record the macro definitions as lists during -;;; the bootstrap. Once everything is compiled, we want to dump the -;;; whole global environment to the output file to reproduce it in the -;;; run-time. However, the environment must contain expander functions -;;; rather than lists. We do not know how to dump function objects -;;; itself, so we mark the list definitions with this object and the -;;; compiler will be called when this object has to be dumped. -;;; Backquote/unquote does a similar magic, but this use is exclusive. -;;; -;;; Indeed, perhaps to compile the object other macros need to be -;;; evaluated. For this reason we define a valid macro-function for -;;; this symbol. -(defvar *magic-unquote-marker* (gensym "MAGIC-UNQUOTE")) -(setf (macro-function *magic-unquote-marker*) - (lambda (form env) - (declare (ignore env)) - (second form))) - ;;; Compile jscl into the host (with-compilation-unit () (dolist (input *source*) diff --git a/src/compiler.lisp b/src/compiler.lisp index 6eaa85d..28918e3 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -498,6 +498,25 @@ (incf index)) output)) +;;; BOOTSTRAP MAGIC: We record the macro definitions as lists during +;;; the bootstrap. Once everything is compiled, we want to dump the +;;; whole global environment to the output file to reproduce it in the +;;; run-time. However, the environment must contain expander functions +;;; rather than lists. We do not know how to dump function objects +;;; itself, so we mark the list definitions with this object and the +;;; compiler will be called when this object has to be dumped. +;;; Backquote/unquote does a similar magic, but this use is exclusive. +;;; +;;; Indeed, perhaps to compile the object other macros need to be +;;; evaluated. For this reason we define a valid macro-function for +;;; this symbol. +(defvar *magic-unquote-marker* (gensym "MAGIC-UNQUOTE")) +#+common-lisp +(setf (macro-function *magic-unquote-marker*) + (lambda (form &optional environment) + (declare (ignore environment)) + (second form))) + (defvar *literal-table* nil) (defvar *literal-counter* 0) -- 1.7.10.4