Hi,
When you use C-c C-k in emacs/SLIME/sbcl produces the output:
"(function () { var div1 = createElement(div); return null; })();"
If you do C-C C-k again though, you get the (expected) output:
"(function () { var div = document.createElement('DIV'); return null; })();"
The problem is (I think) that DEFPSMACRO expands into a PROGN and therefore the SETFs have no effect until load time, by which point the PS form has already been converted into the string.
If changed to an EVAL-WHEN:
(defmacro defpsmacro (name args &body body) (defined-operator-override-check name (multiple-value-bind (macro-fn-form effective-lambda-list) (make-ps-macro-function args body) `(eval-when (:compile-toplevel :load-toplevel :execute) (setf (gethash ',name *macro-toplevel*) ,macro-fn-form) (setf (gethash ',name *macro-toplevel-lambda-list*) ',effective-lambda-list) ',name))))
Then it compiles as expected the first time as well.
Oops, forgot to attach the file.
On 07/03/13 23:07, Peter Stirling wrote:
Hi,
When you use C-c C-k in emacs/SLIME/sbcl produces the output:
"(function () { var div1 = createElement(div); return null; })();"
If you do C-C C-k again though, you get the (expected) output:
"(function () { var div = document.createElement('DIV'); return null; })();"
The problem is (I think) that DEFPSMACRO expands into a PROGN and therefore the SETFs have no effect until load time, by which point the PS form has already been converted into the string.
If changed to an EVAL-WHEN:
(defmacro defpsmacro (name args &body body) (defined-operator-override-check name (multiple-value-bind (macro-fn-form effective-lambda-list) (make-ps-macro-function args body) `(eval-when (:compile-toplevel :load-toplevel :execute) (setf (gethash ',name *macro-toplevel*) ,macro-fn-form) (setf (gethash ',name *macro-toplevel-lambda-list*) ',effective-lambda-list) ',name))))
Then it compiles as expected the first time as well.
parenscript-devel mailing list parenscript-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel@common-lisp.net