Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 42011fea5413b48c1aab74ff8782d910a447d30b
Ticket: bfe0f34e6ca558c525d3d649f93970e2267b5ff1
catch and yieldto
User & Date: ferrieux on 2017-06-05 22:37:24
Changes

  1. closedate changed to: "2457910.44264054"
  2. closer changed to: "ferrieux"
  3. icomment:
    Here is a notation that might be illustrative:
    
     . is normal calling (callstack nesting)
     ; is coro-floor in active stack (defines the left boundary of what gets "put aside" by [yield])
     & is coro-floor in inactive stack
    
    (1) f1 calls f2 calls f3
    
     f1.f2.f3
    
    (2) f1 calls f2 calls f3 starts coro f4 calls f5
    
     f1.f2.f3;f4.f5
    
    (3) f1 calls f2 calls f3 starts coro f4 calls f5 yields 
    
     f1.f2.f3
     &f4.f5
    
    (4) f1 calls f2 calls f3 resumes f4+f5
    
     f1.f2.f3;f4.f5
    
    (5) f1 calls f2 calls f3 starts coro f6 (after f5 yields again)
    
     f1.f2.f3;f6
     &f4.f5
    
    (6) f6 then [yieldsto] f4 : essentially a "branch swap":
    
     f1.f2.f3;f4.f5
     &f6
    
    (7) f5 raises an error: it can be caught in f3, f2, or f1. Note that any number of [yieldto] steps can be inserted, we'll always end up with the same active stack f1.f2.f3;f4.f5 , and all the intermediary yielded-tos will be there as inactive stacks: &f6 , &f7, ...
    
    
    Bottom line: the "non-propagation" through f6, f7, etc. is just a consequence of the fact that they are "no longer on the path", since [yieldto]s branch-swapping surgically bolts the error-generating branch f4.f5 on top of the active stack f1.f2.f3.
    
    So, in addition to not being a bug, it would seem pretty hard to do otherwise ;-)
    
  4. login: "ferrieux"
  5. mimetype: "text/plain"
  6. status changed to: "Closed"