<br><br><div class="gmail_quote">On Sun, Nov 1, 2009 at 9:34 AM, Vladimir Sedach <span dir="ltr"><<a href="mailto:vsedach@gmail.com">vsedach@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">> Maybe this limitation can be avoided by having an mv-returning function A<br>
> set a global variable "mvFunctionReturner" equal to the function A and a<br>
> mv-receiver can check that mvFunctionReturner is set according to the<br>
> function it called expecting multiple values. Does this scheme miss any<br>
> cases?<br>
<br>
</div>What about anonymous functions?<br></blockquote><div><br>It would require that an anonymous function being called in Parenscript source be stored in a variable in the caller. for example, take the (implicitly returning) functions below:<br>
<br>(defun foo ()<br> (multiple-value-bind (x y)<br> (funcall (lambda (z) (values z (+ z 17))) 4)))<br><br>=><br>function foo () {<br><br>var gensymed_lambda = function(z) { mvFunctionReturner = arguments.callee; mv = [ z+ 17]; return z; }<br>
// bind the results of calling the lambda<br>var x = gensymed_lambda(4);<br><br>var y = null;<br>if (gensymed_lambda === mvFunctionReturner)<br> y = mv[0];<br><br>// now implicitly return the same values<br>mvFunctionReturner = arguments.callee; // arguments.callee === foo unless foo is renamed<br>
return x;<br>}<br><br>You can deal with anonymous functions basically by naming them, at least in this scheme.<br> <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
I like this idea, and I think it can be made to work. Have you looked<br>
at whether Linj tries to do multiple return values?</blockquote><div><br>Good idea. Linj seems to be defunct and inaccessible, unfortunately.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I suspect someone<br>
somewhere has thought about and possibly solved this problem before.<br>
<font color="#888888"><br>
Vladimir<br></font></blockquote><div><br><br>Thanks,<br>Red<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><font color="#888888">
</font><div class="im"><br>
> Anyway I have thought a little bit about this and I thought I would pass it<br>
> off to the rest of the Parenscripters as a thought experiment. Assume you<br>
> can do a lot more semantic analysis than Parenscript currently does and<br>
> transform the compiled source however you want. But any compiled functions<br>
> must still be able to be treated as normal Javascript functions and all and<br>
> only functions that should return multiple values appear to return them.<br>
><br>
> Cheers,<br>
> Red<br>
><br>
</div><div><div></div><div class="h5">> _______________________________________________<br>
> parenscript-devel mailing list<br>
> <a href="mailto:parenscript-devel@common-lisp.net">parenscript-devel@common-lisp.net</a><br>
> <a href="http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel" target="_blank">http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel</a><br>
><br>
><br>
<br>
_______________________________________________<br>
parenscript-devel mailing list<br>
<a href="mailto:parenscript-devel@common-lisp.net">parenscript-devel@common-lisp.net</a><br>
<a href="http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel" target="_blank">http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel</a><br>
</div></div></blockquote></div><br>