[parenscript-devel] Implicit return for function bodies

Daniel Gackle danielgackle at gmail.com
Thu Dec 3 21:10:33 UTC 2009


Just to follow up on this point:

< Regarding try/catch, I'm still on the fence. Anyone have try/catch use
cases where implicit return is not what would be wanted? >

It seems pretty clear to me that there should be implicit return inside
CATCH blocks. After all, there is implicit return inside TRY, and by
definition, the code was never able to actually execute that return.
Something ought to take its place. We have three or four usages where we've
had to hack an explicit return back into our PS, just so that an error
object makes it out of CATCH.

Equally important, it seems to me, is that FINALLY blocks *not* provide
implicit return. Either a TRY or CATCH has already specified a return value;
FINALLY is usually for tying up loose ends, not overriding the return value.
In other words, I think the existing behavior around FINALLY is good.

If no one objects, can you go ahead and put implicit return into CATCH so I
can take out our hack?

Daniel



On Sun, Nov 22, 2009 at 12:27 AM, Vladimir Sedach <vsedach at gmail.com> wrote:

> I've just pushed a patch that should address all the issues raised so
> far in this thread. Thank you for the QA Scott!
>
> Regarding try/catch, I'm still on the fence. Anyone have try/catch use
> cases where implicit return is not what would be wanted?
>
> Vladimir
>
> 2009/11/5  <sblist at me.com>:
> > Vladimir and friends,
> >
> > In the following example, do you think that both
> > the try block and the handler blocks should receive
> > an explicit return?
> >
> > I'm not absolutely convinced, but I think that it
> > probably should.
> >
> > PS> (ps (lambda () (try (foo) (:catch (e) e))))
> > =>
> > "function () {
> >     try {
> >         return foo();
> >     } catch (e) {
> >         e;
> >     };
> > };"
> >
> > - 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 at common-lisp.net
> >> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
> >
> >
> > _______________________________________________
> > parenscript-devel mailing list
> > parenscript-devel at common-lisp.net
> > http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
> >
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20091203/340388cc/attachment.html>


More information about the parenscript-devel mailing list