[parenscript-devel] Implicit return for function bodies

Vladimir Sedach vsedach at gmail.com
Wed Dec 2 00:12:09 UTC 2009


I pushed a fix that should handle the iteration special forms
correctly (the previous code had macros and not the special forms to
which they expanded in the statements list). Thanks again for the QA.

Vladimir

2009/11/29  <sblist at me.com>:
> Hi Vladimir,
>
> On 2009-11-27, at 5:24 PM, Vladimir Sedach wrote:
>
>> Just pushed patches that fix RETURNing of cond and symbol-macrolet.
>> Let me know if you catch anything else amiss.
>>
>> Thank you,
>> Vladimir
>>
>> 2009/11/23  <sblist at me.com>:
>>> On 2009-11-05, at 12:20 PM, sblist at me.com wrote:
>>> ...
>>>
>>> This is still the case as of the latest commit, so
>>> code like this fails:
>>>
>>> (ps (lambda ()
>>>      (cond ((foo? x) (loop for y in x do (foo y)))
>>>            ((bar? x) x)
>>>            (t t))))
>
> This form now emits valid JS. However, using DOLIST instead
> of LOOP here causes a syntax error:
>
> (ps (lambda ()
>      (cond ((foo? x) (dolist (y x) (foo y)))
>            ((bar? x) x)
>            (t t))))
> =>
> "function () {
>    if (foowhat(x)) {
>        return for (var y = null, _js_idx1288 = 0; _js_idx1288 < x.length; _js_i\
> dx1288 += 1) {
>            y = x[_js_idx1288];
>            foo(y);
>        };
>    } else if (barwhat(x)) {
>        return x;
>    } else {
>        return true;
>    };
> };"
>
> Here is some more curious DOLIST behavior:
>
> SKYSHEET> (ps (lambda () (dolist (arg args) (foo arg))))
> "function () {
>    for (var arg = null, _js_idx1289 = 0; _js_idx1289 < args.length; _js_idx1289\
>  += 1) {
>        arg = args[_js_idx1289];
>        foo(arg);
>    };
> };"
> SKYSHEET> (ps (lambda () (let ((x y)) (dolist (arg args) (foo arg)))))
> "function () {
>    var x = y;
>    return for (var arg = null, _js_idx1290 = 0; _js_idx1290 < args.length; _js_\
> idx1290 += 1) {
>        arg = args[_js_idx1290];
>        foo(arg);
>    };
> };"
>
> - 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