Skip to content
Tcl Source Code History Of Ticket 3048771
Login

History Of Ticket 3048771

Artifacts Associated With Ticket 3048771

  1. Ticket change [38941f20d5] (rid 112235) by dgp on 2010-08-19 16:20:31:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      
      A celebrated feature of Tcl is the ability to replace
      built-in commands with functionally equivalent procs.
      The constraints on [tailcall] diminish that ability.
      
      Utility command from TIP 90:
      
      % namespace eval control {
           proc ascaller script {
               if {[info level] < 2} {
                   return -code error \
                           "[lindex [info level 0] 0] called outside a proc"
               }
               variable result
               variable options
               set code [uplevel 2 \
                       [list ::catch $script   [namespace which -variable result] \
                                               [namespace which -variable options]]]
               if {$code == 0} {
                   return $result
               }
               dict incr options -level 2
               return -options $options $result
           }
       }
      % proc myIf {cond body} {
          set bool [control::ascaller [list ::expr $cond]]
          if {!$bool} return
          return [control::ascaller $body]
      }
      % proc good {} {if 1 {tailcall concat}}
      % good
      % proc bad {} {myIf 1 {tailcall concat}}
      % bad
      tailcall can only be called from a proc or lambda
      
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "dgp"
    10. subsystem initialized to: "45. Parsing and Eval"
    11. title initialized to:
      tailcall constraints chafe with control command procs
      
    12. type initialized to: "Bug"
  2. Ticket change [4c33f8f10c] (rid 126840) by ferrieux on 2010-08-19 23:49:24:

    1. icomment:
      Possibilities:
       (1) lose trust in [catch].
       (2) silently turn [tailcall] into a normal call when crossing a catch boundary, putting a limit on iterations (stack full).
       (3) automagically detect [catch] when it is at the end of a proc, and allow tailcall to cross it in that case.
      Preferences ?
      
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  3. Ticket change [f463c22ee2] (rid 129906) by dgp on 2010-08-19 23:55:22:

    1. icomment:
      
      Still exploring the space, but currently my
      preferences is to reduce the amount of
      new "magic" in the implementation of
      [tailcall] and let it use return codes like
      any other command (and interact with
      [catch] the same way as any other command).
      Not yet clear whether it needs a new code,
      or whether TCL_RETURN will do.
      
      Miguel has suggested in the chat room that
      [tailcall] might be revised to become the
      (near- ?) equivalent of [atProcExit....; return].
      Such a revision ought to play well with [catch], 
      [uplevel], etc.  But all the implications are not
      yet laid out.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [f534fa2494] (rid 130068) by msofer on 2010-08-20 02:44:23:

    1. icomment:
      Attached a patch that implements tailcall as returning TCL_RETURN, and where this works ok.
      
      Changes in behaviour:
        - catch stops tailcall, but is not an error. The tailcall is scheduled anyway, and hence it will run unless it is cleared
        - tailcall with no arguments just clears any tailcall that might have been scheduled
        - tailcall replaces any previously scheduled tailcall with the new one
      
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  5. Ticket change [e3523a9691] (rid 87777) by msofer on 2010-08-20 02:45:00:

    1. icomment:
      
      
      File Added - 383990: diffH
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  6. Ticket change [aa928298d8] (rid 100946) by msofer on 2010-08-20 07:27:49:

    1. icomment:
      
      
      File Added - 384007: newTailcall.patch
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  7. Ticket change [b96672265b] (rid 129134) by msofer on 2010-08-20 07:28:02:

    1. icomment:
      
      
      File Deleted - 383990: 
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  8. Ticket change [76221ceb84] (rid 105518) by msofer on 2010-08-21 04:20:23:

    1. icomment:
      Better patch, fixes tailcall/coroutine interaction. Different from HEAD, but HEAD was arguably wrong: tailcall-13.1 fails.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  9. Ticket change [6e94e73fea] (rid 100174) by msofer on 2010-08-21 04:21:06:

    1. icomment:
      
      
      File Added - 384089: newTailcall2.patch
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  10. Ticket change [8f38399f34] (rid 120246) by msofer on 2010-08-21 21:12:09:

    1. icomment:
      Those patches did not apply - sorry about that. Removed them, new one should be ok.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  11. Ticket change [eda5efff08] (rid 103924) by msofer on 2010-08-21 21:12:30:

    1. icomment:
      
      
      File Deleted - 384089: 
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  12. Add attachment "newTailcall.patch" [2a8709962c] (rid 118594) by msofer on 2010-08-21 21:12:53.

  13. Ticket change [135abc2d8b] (rid 124201) by msofer on 2010-08-21 21:12:53:

    1. icomment:
      
      
      File Added - 384134: newTailcall.patch
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  14. Ticket change [7007bb4e7d] (rid 100406) by dgp on 2010-08-22 00:12:58:

    1. icomment:
      
      Also broken, though less severely.
      Uploading a working patch.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  15. Ticket change [9c8c6ca1da] (rid 96162) by dgp on 2010-08-22 00:13:18:

    1. icomment:
      
      
      File Added - 384146: 3048771.patch
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  16. Add attachment "3048771.patch" [67fe52a4ce] (rid 102990) by dgp on 2010-08-22 00:13:18.

  17. Ticket change [9b29cf8fd9] (rid 111077) by ferrieux on 2010-08-22 05:31:57:

    1. icomment:
      Note that in such cases the order of execution is sometimes funny, tailcall scheduling something for execution at proc exit, but still disrupting the current sequence within the catch range... (That's just a note, OK once acknowledged)
      
      Also note that an alternative would be 'eventually', that does only the scheduling-at-exit part, not the error code:
      
         proc f {} {
            puts AAA
            eventually g
            puts BBB
         }
      
      so that the current tailcall would be [eventually ...;return]
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  18. Ticket change [1410c035d2] (rid 124327) by dgp on 2010-08-24 20:51:42:

    1. icomment:
      
      One place where this implementation may
      cause surprise is with commands like [subst]
      that have their own treatment of TCL_RETURN.
      
      proc demo {template} {
          ...
          set result [subst $template]
          ....
          return $result
      }
      demo {[tailcall puts foo]}
      
      The [subst] will effectively [catch] the TCL_RETURN.
      The rest of [demo] will run, and then, possibly long
      after the [subst], when [demo] returns, its results will
      get replaced by the results of running [puts foo].
      
      Similar issue is possible with [source].
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  19. Ticket change [bfbb750800] (rid 102296) by msofer on 2010-08-30 21:08:29:

    1. closedate changed to: "2010-08-30T14:08:29"
    2. closer changed to: "msofer"
    3. icomment:
      
      
      allow_comments - 1
      
      Patch committed; mores docs and tests needed: see new ticket #3056056
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "msofer"