| Ticket UUID: | 3603695 | ||
| Title: | TclOO: varnames incorrect when used from other object method | ||
| Type: | Bug | Created on: | 2013-02-07 12:04:39 |
| Submitter: | taylor_venable | Assigned to: | dkf |
| Subsystem: | 35. TclOO Package | Severity: | |
| Priority: | 8 | Last modified: | 2013-02-09 19:32:28 |
| Status: | Closed | Closed by: | dkf |
| Resolution: | Fixed | Closed on: | 2013-02-09 12:32:28 |
| Version: | current: 8.6.0 | ||
| Description: | ||||
When using oo::object's varname method on an object within the context of another object's method, [$other varname x] returns as if invoked as [my varname x]. Changing the context (e.g. by using [uplevel #0 $other varname x]) returns the correct result. Example code and output attached. Tcl Version: 8.6.0 TclOO Version: 1.0 OS Platform & Version: Linux 3.5.7 | ||||
| User Comments: | ||||
taylor_venable added on 2013-02-07 19:04:40:
File Added - 460258: test.tcl dkf added on 2013-02-08 21:00:58:
The 'variable' declaration is critical to the problem, as the test case I'm working on (see below) succeeds without it and fails with it. Very strange!
test oo-19.3 {OO: varname method and variable decl: Bug 3603695} -setup {
oo::class create testClass {
variable foo
export varname
constructor {} {
variable foo x
}
method bar {obj} {
my varname foo
$obj varname foo
}
}
} -body {
testClass create A
testClass create B
lsearch [list [A varname foo] [B varname foo]] [B bar A]
} -cleanup {
testClass destroy
} -result 0
dkf added on 2013-02-09 19:32:28:
allow_comments - 1 Fixed for the next release of Tcl 8.6; will also apply to TclOO package for its future releases. | ||||
