Skip to content
Tcl Source Code History Of Ticket 477c24cb39e3c502
Login

History Of Ticket 477c24cb39e3c502

Artifacts Associated With Ticket 477c24cb39e3c502

  1. Ticket change [6791daeac0] (rid 148517) by pooryorick on 2016-08-31 11:17:04:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      In the following example, <code>-custom1 1</code> is missing from
      <code>$options</code> in <code>p2</code>
      
      <code><verbatim>
      namespace eval ns1 {
      	rename ::set [namespace current]::set
      	interp alias {} ::set {} [namespace current]::set
      }
      
      proc p1 {} {
      	return -options {-custom1 1} {result 1} 
      }
      
      proc p2 {} {
      	catch {set status [p1]} result options
      	puts $options
      } 
      
      p2
      </verbatim></code>
      
    5. foundin initialized to: "8.6.6"
    6. is_private initialized to: "0"
    7. login: "pooryorick"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "e476148cded301ffff84bcdc432536dc0c949e88"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "pooryorick"
    14. subsystem initialized to: "18. Commands M-Z"
    15. title initialized to: "rename ::set and lose custom return options"
    16. type initialized to: "Bug"
  2. Ticket change [d35c9e82db] (rid 148520) by aspect on 2016-09-01 13:04:34:

    1. icomment:
      This thread seems to go deep:
      
      proc p0 {} {
      	list result 0
      }
      proc p1 {} {
      	return -options {-custom1 1} {result 1}
      }
      
      proc t0 {} {
      	list [catch {p1; p0} r o] $r $o
      }
      
      proc t1 {} {
      	list [catch {p1} r o] $r $o
      }
      
      proc t2 {} {
      	list [catch {p1; list result 2} r o] $r $o
      }
      
      puts [t0]
      puts [t1]
      puts [t2]
      # 0 {result 0} {-code 0 -level 0}
      # 0 {result 1} {-custom1 1 -code 0 -level 0}
      # 0 {result 2} {-custom1 1 -code 0 -level 0}
      </verbatim></code>
      
      It looks on first glance like bytecode instructions are not resetting returnOpts.  Or are t1 and t2 expected?
      
    2. login: "aspect"
    3. mimetype: "text/plain"
  3. Ticket change [3a7097884b] (rid 148522) by aspect on 2016-09-01 13:24:02:

    1. icomment:
      Related?
      
      % list [catch {unset -nocomplain t} r o] $r $o
      0 {} {-code 0 -level 0}
      % list [catch {incr t} r o] $r $o
      0 1 {-code 0 -level 0 -errorcode {TCL READ VARNAME}}
      % list [catch {incr t} r o] $r $o
      0 2 {-code 0 -level 0}
      
    2. login: "aspect"
    3. mimetype: "text/plain"
  4. Ticket change [32273ff810] (rid 148524) by dgp on 2016-09-01 17:05:38:

    1. icomment:
      
      Some of the comments here are Dups of
      
      http://core.tcl.tk/tcl/tktview?name=2433843
      
      Not sure about the original report yet.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  5. Ticket change [be1a192f33] (rid 148525) by dgp on 2016-09-01 17:31:00:

    1. icomment:
      
      Here's another demo, that I find more focused:
      
      proc p1 {} {return -custom1 1 1}
      proc p2 {b} {
          if {$b} {
              catch {set status [p1]} m o
          } else {
              set set set
              catch {$set status [p1]} m o
          }
          return $o
      }
      puts [p2 0]
      puts [p2 1]
      
      Demonstrates a clear difference in bytecode
      execution compared to non-bytecode script evaluation.
      They ought to be the same and they are not, so yes
      there's a bug.
      
      This leads to an unsettling debate over which
      is correct.  How long should a return
      option survive when return code is TCL_OK ?
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  6. Ticket change [cb4fc19f21] (rid 148526) by dgp on 2016-09-01 17:35:49:

    1. icomment:
      
      Change p1 to:
      
      proc p1 {} {return -custom 1 -code 10 1}
      
      so that a custom code is used along with
      a custom option (which was the use case)
      and see that that case preserves the option
      in both branches.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  7. Ticket change [004f9305e9] (rid 148550) by pooryorick on 2016-09-02 08:06:24:

    1. icomment:
      So the bug is the inverse of what I originally reported.  It's not that <code>-custom1 1</code> is missing from <code>$options</code>, but that it's present if the example doesn't rename the "::set" command.  Thank you for the analysis.
      
    2. login: "pooryorick"
    3. mimetype: "text/plain"
  8. Ticket change [4351a960d3] (rid 149127) by dkf on 2016-10-09 14:51:26:

    1. assignee changed to: "dgp"
    2. icomment:
      Tempted to suggest not fixing given the performance impact it would have, but dgp invented the custom return option machinery so he can worry about the impact.
      
    3. login: "dkf"
    4. mimetype: "text/x-fossil-wiki"
    5. priority changed to: "3 Low"
    6. username: "dkf"