Hi Vladimir,
Another tricky area for implicit return is in IF/WHEN/UNLESS. What happens currently is that when a conditional is in an expression place (such as after a RETURN statement), it is converted into a ternary expression.
This works when the branches of the conditional contain only assignments and expressions, but you get a syntax error if there is a switch, for, or while statement in the branch body.
I'm not sure how to handle this in the general expression-place scenario, but it seems like implicit return should handle all of the conditional branches -- something like this:
(ps (lambda () (when x y))) => "function () { return x ? y : null; };"
becomes:
(ps (lambda () (when x y))) => "if (x) { return y; };"
or perhaps:
(ps (lambda () (when x y))) => "if (x) { return y; } else { return null; };"
- Scott
On 2009-11-04, at 12:57 PM, Vladimir Sedach wrote:
Hello,
Many of you have been asking for this for a long time, and based on feedback (as well as my own experience) the lack of this feature has been the biggest cause of bugs in PS code, so it's with a bit of joy that I just pushed out a patch to add implicit returns to PS functions (including lambdas and flet/labels) to the repository just now. Please try it out and report any bugs you find!
Thank you, Vladimir
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel