[parenscript-devel] A simpler way to do multiple value return? (Was: PS test failures in 7be9b45)

Vladimir Sedach vsedach at gmail.com
Sat Sep 8 01:00:28 UTC 2012

> You'd want "EXTRAS = null" after each MULTIPLE-VALUE-BIND as well, but
> maybe you get this for free since the function call in a
> MULTIPLE-VALUE-BIND is by definition not a tail call.
> We can summarize this proposal similarly to the other one:
>   1. Pass multiple values using a global variable
>   2. Instrument every non-tail call.
> It may still be too naive but it at least fixes the examples that
> broke GV earlier in the thread. So, is there an example that works in
> foo.mv but fails in GV as described above?

I see a problem in that you'd have to instrument not just return
statments, but any kind of control flow that goes up the stack - so
you'd have to put the suppression code at the end of every function
definition, and also wrap throws. So this wouldn't work if you call a
JS function expecting multiple values, and that JS function happens to
call a PS function that wants to return multiple values.

> p.s. I also wonder if the recursion difficulty disappears now that we
> understand passthrough better. The example was:
>   (defun foo (x)
>     (if (= x 1)
>         (values 1 2)
>         (1+ (foo (1- x)))))
> In both the GV and foo.mv designs, shouldn't foo(2) do the right thing
> now? That recursion is a non-tail call, so GV would suppress MV
> passthrough and foo.mv wouldn't enable it.

You're right. Good point.


More information about the parenscript-devel mailing list