[parenscript-devel] Updates to PS LOOP

Daniel Gackle danielgackle at gmail.com
Sun Aug 16 00:33:10 UTC 2009


Javascript's FOR and CL's LOOP disagree about how to interpret end-tests and
step-forms. In JS, all of the step forms are evaluated before any of the end
tests are, while in LOOP, the end-test for one :FOR clause is evaluated
(and, if it fails, the loop terminates) before the step-form for the next
:FOR clause is processed. The syntax of LOOP strongly implies the latter
behavior. This was leading to unwanted surprises, since the generated JS FOR
loop wasn't always terminating when expected. After a dozen or more
experiences of JS code crashing because of this contradiction, I bit the
bullet and made LOOP generate different JS code when multiple :FOR clauses
are specified. This makes the generated code more verbose, because end-tests
and step-forms can't be inlined into the FOR block anymore. But now the code
does what LOOP implies.

This patch has been pushed (along with a couple of very minor tweaks to
special-forms.lisp).

Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20090815/eac12bb1/attachment.html>


More information about the parenscript-devel mailing list