That's completely correct. I probably forgot that I didn't finish the functionality before pushing out a patch. I've pushed a fix that returns the value, but warns about "returning from unknown block." That will be fixed later - the loop return code is kind of weird right now.
Vladimir
On Tue, Apr 10, 2012 at 10:22 PM, Daniel Gackle danielgackle@gmail.com wrote:
Commit 83f4ea appears to have implemented return values from loop expressions, which is great and something I've wanted for a long time. But there seems to be a bug insofar as the return values never actually get returned:
An example is this FOR loop - foo() should return 40 but returns NaN (10 * null) instead:
(defun foo () (* 10 (for ((i 0)) ((< i 10)) ((incf i)) (when (> i 3) (return i)))))
=>
function foo() { return 10 * (function () { var loopResultVar6945 = null; for (var i = 0; i < 10; ++i) { if (i > 3) { loopResultVar6945 = i; break; }; }; loopResultVar6945; })(); };
I get the same result using the LOOP macro, and WHILE loops have the same problem.
Daniel
parenscript-devel mailing list parenscript-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel