<div>I have a question about Vladimir's proposal upthread (from Aug 30) for</div><div>passing implicit mv arrays. The idea is to pass MV by setting <a href="http://FOO.MV">FOO.MV</a></div><div>before calling FOO, and to read MV passed to oneself as</div>

<div><a href="http://ARGUMENTS.CALLEE.MV">ARGUMENTS.CALLEE.MV</a>.</div><div><br></div><div>As we've been discussing, correct MVR must: (1) enable passthrough</div><div>where it's wanted, and (2) suppress passthrough where it's not wanted.</div>

<div>This proposal gets (1) by instrumenting code to pass MV everywhere it</div><div>might be needed, and (2) by simply not instrumenting where it isn't</div><div>wanted [*]. Here's Vladimir's original example (with comment edited):</div>

<div><br></div><div>  (defun foo (x y z)</div><div>    (values x y z))</div><div><br></div><div>  (defun bar ()</div><div>    (foo)</div><div>    (foo))</div><div><br></div><div>  function bar () {</div><div>    foo(); // no instrumentation since passthrough is not wanted</div>

<div>    <a href="http://foo.mv">foo.mv</a> = <a href="http://arguments.callee.mv">arguments.callee.mv</a>;</div><div>    var result = foo();</div><div>    delete <a href="http://foo.mv">foo.mv</a>;</div><div>    return result;</div>

<div>  }</div><div><br></div><div>But passthrough is transitive, so we can't just instrument tail calls</div><div>to FOO [**]. We also have to instrument tail calls to things that tail</div><div>call FOO, like BAZ here:</div>

<div><br></div><div>  (defun foo (x y z)</div><div>    (values x y z))</div><div><br></div><div>  (defun baz ()</div><div>    (foo))</div><div><br></div><div>  (defun bar ()</div><div>    (foo)</div><div>    (baz))</div>
<div>
<br></div><div>Given this transitivity, how do you distinguish which tail calls are</div><div>potentially-multi-valued in order to instrument them? Keep in mind</div><div>that passthrough also has to work in cases like:</div>

<div><br></div><div>  (defun baz2 (fn)</div><div>    (apply fn '(1 2 3))</div><div><br></div><div>  (defun baz3 ()</div><div>    (funcall *fn* 1 2 3))</div><div><br></div><div>... whenever the calls to FN and *FN* are potentially-multi-valued.</div>

<div><br></div><div>The only easy implementation I can think of is to mv-instrument every</div><div>tail call in the program, but that is surely overkill.</div><div><br></div><div>Daniel</div><div><br></div><div>[*] There's also the recursive case we've been discussing, where you</div>

<div>might both want the instrumentation and not want it -- but since my</div><div>question doesn't depend on that complication, let's just ignore it here.</div><div><br></div><div>[**] Just to be clear, all I mean by "tail call" is any expression</div>

<div>"(return (some-function))" once PS is done adding in all the implicit</div><div>returns.</div><div><br></div>