Overview
| Artifact ID: | f599fb3f1b2827dbe8c5c25da648a3c2b4af15b6 |
|---|---|
| Ticket: | 0f42ff78717afacc72710ec0c79aa71a48abb5f3
[tailcall] punches through [next] |
| User & Date: | dkf on 2015-04-08 21:27:41 |
Changes
- icomment:
I'm not going to recommend merging anything until we figure out what the behaviour <i>should</i> be. To do that, we need a few cases. <h2>Simple case</h2> <pre> oo::class create Foo { method bar {} { tailcall puts hi puts xyz } } [Foo create foo] bar </pre> This should replace the invoke of bar on foo with a call to puts. Expected output: <pre>hi</pre> <h2>Complex case 1</h2> <pre> oo::class create Foo { method bar {} { tailcall puts hi puts xyz } } oo::class create Foo2 { superclass Foo method bar {} { puts a next } } [Foo2 create foo] bar </pre> Expected output: <pre> a hi </pre> <h2>Complex case 2</h2> <pre> oo::class create Foo { method bar {} { tailcall puts hi puts xyz } } oo::class create Foo2 { method Bar {} { puts a next } filter Bar } Foo create foo oo::objdefine foo mixin Foo2 foo bar </pre> Same expected output as above. <p> But what if the filter wants to process the result? What if there's a [<tt>catch { next } msg opt</tt>] in there? My head aches when I try to think about these things. <h1>Possible Principles Leading to a Fix</h1> A method ought to work "the same" whether or not it has been overridden by a subclass. A tailcalled command ought to have as parent stack the same thing you'd get with <tt>uplevel 1</tt>. A subclass will often expect the superclass's result to be the result that would be returned if the subclass was not there. <p> I ought to look what happens with <tt>catch { tailcall foo }</tt>... - login: "dkf"
- mimetype: "text/html"
- username: "dkf"