[parenscript-devel] Multiple value calls
Red Daly
reddaly at gmail.com
Sun Nov 1 03:35:06 UTC 2009
Hi Parenscripters,
As far as I can tell, multiple-value function calls are a unique feature of
lisp. I would like the ability to perform multiple-value calls in
Parenscript but I don't know if a sane solution exists or not.
Can anyone come up with a scheme for returning multiple values that
translates well to Javascript? Ideally such a scheme would not introduce
much overhead for usual functions that do not use or return multiple values
(though perhaps setting some sort of global MV flag might be inexpensive
enough). Functions that return multiple values should also only appear to
return a single value when called by a function that expects only one return
value (including native javascript functions).
(defun paren-mv-returner ()
(return (values 1 2 3)))
=>
function parenMvReturner() {
/* do some magic with the values 2 and 3 */
return 1;
}
// one implementation might be
var mv = undefined;
function parenMvReturner() {
mv = [2, 3];
return 1;
}
// this scheme needs to adjust the return statement of every function so it
might not be sufficient
// consider this other function
function parenMySingleReturner () {
var x = parenMvReturner();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20091031/ce8c0fc7/attachment.html>
More information about the parenscript-devel
mailing list