[parenscript-devel] Bug: RETURN-FROM inside a lambda doesn't return anything

Daniel Gackle danielgackle at gmail.com
Thu Sep 15 23:41:09 UTC 2011


I pushed a very simple patch for this bug. It still isn't correct, because
the resulting code generates a warning, but it's a lot closer to correct
than not returning a return value at all. I wasn't sure how to make a
correct fix, but I badly need this return value, and this can serve as an
interim compromise. On a positive note, this shows how valuable the feature
is! (Vladimir, when you get to this, feel free to undo my oversimplified
change.)

Daniel


On Mon, Aug 29, 2011 at 11:56 AM, Daniel Gackle <danielgackle at gmail.com>wrote:

> I thought this was working at some point, but it doesn't seem to now. FOO()
> returns undefined in JS, when it should return 123:
>
> (defun bar (fn)
>   (funcall fn))
>
> (defun foo ()
>   (bar (lambda () (return-from foo 123))))
>
> It seems the value stored under the name "ps-return-value" isn't actually
> returned:
>
> function foo() {
>     try {
>         return bar(function () {
>             throw { 'ps-block-tag' : 'foo', 'ps-return-value' : 123 };
>         });
>     } catch (err) {
>         if (err && 'foo' === err['ps-block-tag']) {
>             err['ps-return-value'];
>         } else {
>             throw err;
>         };
>     };
> };
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20110915/88454067/attachment.html>


More information about the parenscript-devel mailing list