[parenscript-devel] Macro symbols affect GENSYMing in LET
sblist at me.com
sblist at me.com
Thu Jun 4 21:38:04 UTC 2009
Here is an even more confusing case where BAR
is rewritten inside the + form, but not the -.
> (ps (let ((foo (lambda (bar)
(quote bar)))
(bar 5))
(+ bar (- 10 bar))))
"var foo = function (bar) {
'bar';
};
var bar28523 = 5;
bar28523 + (10 - bar);"
> (ps (let ((foo (lambda (bar)
(quote bar)))
(bar 5))
(+ bar (+ 10 bar))))
"var foo = function (bar) {
'bar';
};
var bar28524 = 5;
bar28524 + (10 + bar28524);"
- Scott
On 4-Jun-09, at 11:10 AM, sblist at me.com wrote:
> I haven't done a very good job of distilling down this bug,
> but we're experiencing an issue with the GENSYMing
> done by LET in the presence of macros with the same
> names as variables bound in LET.
>
> This is the simplest example I could come up with:
>
>> (ps
> (macrolet ((a (n) `(+ ,n 5)))
> (let ((a (a 1)))
> (let ((b (a (- a 4))))
> (+ a b)))))
> "var a1661 = 1 + 5;
> var b = (a - 4) + 5;
> a1661 + b;"
>
> You can see here that the symbol A is GENSYM'd since
> it occurs elsewhere in the LET binding forms, but it seems
> to be missed in the inner LET form. If the symbol A is not
> inside the subtraction form, it is caught:
>
>> (ps
> (macrolet ((a (n) `(+ ,n 5)))
> (let ((a (a 1)))
> (let ((b (a a)))
> (+ a b)))))
> "var a1662 = 1 + 5;
> var b = a1662 + 5;
> a1662 + b;"
>
> - Scott
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
More information about the parenscript-devel
mailing list