Artifacts Associated With Ticket 477c24cb39e3c502
Ticket change [6791daeac0] (rid 148517) by pooryorick on 2016-08-31 11:17:04:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- 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> - foundin initialized to: "8.6.6"
- is_private initialized to: "0"
- login: "pooryorick"
- priority initialized to: "5 Medium"
- private_contact initialized to: "e476148cded301ffff84bcdc432536dc0c949e88"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "pooryorick"
- subsystem initialized to: "18. Commands M-Z"
- title initialized to: "rename ::set and lose custom return options"
- type initialized to: "Bug"
Ticket change [d35c9e82db] (rid 148520) by aspect on 2016-09-01 13:04:34:
- 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? - login: "aspect"
- mimetype: "text/plain"
- icomment:
Ticket change [3a7097884b] (rid 148522) by aspect on 2016-09-01 13:24:02:
- 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} - login: "aspect"
- mimetype: "text/plain"
- icomment:
Ticket change [32273ff810] (rid 148524) by dgp on 2016-09-01 17:05:38:
- icomment:
Some of the comments here are Dups of http://core.tcl.tk/tcl/tktview?name=2433843 Not sure about the original report yet.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [be1a192f33] (rid 148525) by dgp on 2016-09-01 17:31:00:
- 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 ? - login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [cb4fc19f21] (rid 148526) by dgp on 2016-09-01 17:35:49:
- 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. - login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [004f9305e9] (rid 148550) by pooryorick on 2016-09-02 08:06:24:
- 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.
- login: "pooryorick"
- mimetype: "text/plain"
- icomment:
Ticket change [4351a960d3] (rid 149127) by dkf on 2016-10-09 14:51:26:
- assignee changed to: "dgp"
- 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.
- login: "dkf"
- mimetype: "text/x-fossil-wiki"
- priority changed to: "3 Low"
- username: "dkf"