Artifacts Associated With Ticket b80ccfcf323bc456
Ticket change [d0917825c8] (rid 194889) by pooryorick on 2021-06-19 16:58:20:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
As of at least [07f12cf7209a23], core-8-branch, control never reaches the [error] command: <code><verbatim> proc p0 {} { coroutine c2 p1 error {error after returning from c2} } proc p1 {} { yieldto yieldto [list [info coroutine]] } coroutine c1 p0 puts {no error} </verbatim></code> <b>Output:</b> <verbatim> no error </verbatim> - is_private initialized to: "0"
- login: "pooryorick"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Critical"
- status initialized to: "Open"
- submitter initialized to: "pooryorick"
- subsystem initialized to: "- New Builtin Commands"
- title initialized to:
a coroutine yieldsto to yieldto itself, and loses control
- type initialized to: "Bug"
Ticket change [bec28492c2] (rid 194890) by pooryorick on 2021-06-19 17:01:31:
- comment changed to:
As of at least [07f12cf7209a23], core-8-branch, in the following script, control never reaches the [error] command: <code><verbatim> proc p0 {} { coroutine c2 p1 error {error after returning from c2} } proc p1 {} { yieldto yieldto [list [info coroutine]] } coroutine c1 p0 puts {no error} </verbatim></code> <b>Output:</b> <verbatim> no error </verbatim> - login: "pooryorick"
- mimetype: "text/plain"
- comment changed to:
Ticket change [9e116fed4f] (rid 194891) by pooryorick on 2021-06-19 17:05:57:
- login: "pooryorick"
- mimetype: "text/plain"
- title changed to:
a coroutine calls yieldto to yieldto itself, and loses control
Ticket change [240a17a55f] (rid 194896) by dkf on 2021-06-19 20:23:55:
- icomment:
Do the c1 and c2 coroutines exist afterwards? If they do, can you probe them to see what they're doing?
- login: "dkf"
- mimetype: "text/html"
- icomment:
Ticket change [5c116979b4] (rid 194897) by dkf on 2021-06-19 20:37:02:
- icomment:
<code>c2</code> doesn't exist; <code>c1</code> does exist, and is suspended within the call to <code>coroutine</code> <pre> % coroprobe c1 info frame 0 type proc line 2 cmd {coroutine c2 p1} proc ::p0 level 0 </pre> Resuming <code>c1</code> runs the call to <code>error</code>. Neither coroutine exists afterwards. <p> I'm not sure that this is anything but correct. It's weird, but yielding to a yieldto is weird. - login: "dkf"
- mimetype: "text/html"
- icomment:
Ticket change [b54adf045b] (rid 194898) by pooryorick on 2021-06-19 20:50:45:
- closedate changed to: "2459385.36858199"
- closer changed to: "pooryorick"
- icomment:
I see now that the example script is doing the right thing. First c2 yields, and the second yieldto then takes place in the context of c1, causing c1 to yield back to c2. c1 is then no longer on the stack, so when p1 returns, it's no longer returning to p0, which is part of thce c1 context. Instead it returns to the caller of c1, as expected.
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Invalid"
- status changed to: "Closed"