Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a5b2538aa403d83ae89a59df13b93db12d49f5fe2c9a27238ac9785bdbf25799
Ticket: 723a2f4ac32c306a16919568acaf0b78304dea7d
return -code break/tailcall break from coroutine goes wrong at the top-level
User & Date: aspect on 2018-07-31 13:11:32
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    Depending on the set-up, this seems to be sensitive either to the context the coroutine is created in or the context it is called in.  If both have at least one frame on the stack, it works "as expected".
    
    
    % proc p0 {} {yield; return -code break}
    % coroutine c0 p0
    % while 1 c0
    invoked "break" outside of a loop
        while executing
    "p0"
        invoked from within
    "c0"
    
    % apply {{} {coroutine c0 p0}}
    % while 1 c0
    
    % proc p1 {} {yield; tailcall break}
    % coroutine c1 p1
    % while 1 c1
    invoked "break" outside of a loop
        while executing
    "break"
        invoked from within
    "c1"
    
    % coroutine c1 p1
    % apply {{} {while 1 c1}}
    
    
    Another fun one:
    
    $ cat itop.tcl
    if 1 {coroutine c0 try {yield; break}}
    while 1 c0
    puts "ok1"
    
    coroutine c0 try {yield; break}
    while 1 c0
    puts "ok2"
    
    $ tclsh itop.tcl 
    ok1
    invoked "break" outside of a loop
        while executing
    "try {yield; break}"
        invoked from within
    "c0"
        ("while" body line 1)
        invoked from within
    "while 1 c0"
        (file "itop.tcl" line 6)
    
    
    (noticed by pooryorick on the chat yesterday)
    
  5. is_private changed to: "0"
  6. login: "aspect"
  7. priority changed to: "5 Medium"
  8. resolution changed to: "None"
  9. severity changed to: "Minor"
  10. status changed to: "Open"
  11. submitter changed to: "aspect"
  12. subsystem changed to: "60. NRE and coroutines"
  13. title changed to:
    return -code break/tailcall break from coroutine goes wrong at the top-level
    
  14. type changed to: "Bug"