[parenscript-devel] Implicit return for function bodies

Vladimir Sedach vsedach at gmail.com
Thu Nov 5 05:33:43 UTC 2009


I just pushed a patch that should fix that. Thanks for the bug report!

Vladimir

2009/11/4  <sblist at me.com>:
> Hi Vladimir,
>
> Thanks a lot for doing this work, it'll be seriously great to have
> implicit return!
>
> 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!
>
> The first one I encountered was to do with the special return
> handling for case/switch.
>
> 1) The return special form assumes the wrong switch/case
> structure for these statements, it should be:
>
> (switch-case what &rest clauses)
>
> rather than:
>
> (switch-case what clauses)
>
> ...in both the destructing code and the reconstruction of the
> clauses, having been updated with the return statement.
>
> 2) The return special form needs to handle break forms in
> switch/case; rather than wrapping a break statement, it
> should remove it and wrap the previous expression in the
> return statement. Here's the (incorrect) output that I'm getting
> after having fixed the first issue:
>
> (ps (lambda ()  (case 1 (0 1) (otherwise 2))))
>
> "function () {
>    switch (1) {
>    case 0:
>        1;
>        return break;
>    default:
>        return 2;
>    };
> };"
>
> I think we want to see:
>
> "function () {
>    switch (1) {
>    case 0:
>        return 1;
>    default:
>        return 2;
>    };
> };"
>
> - 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