Tcl Source Code

View Ticket
Login
2013-02-09
19:32 Closed ticket [3603695fff]: TclOO: varnames incorrect when used from other object method plus 7 other changes artifact: b2fde8c735 user: dkf
2013-02-08
21:00 Ticket [3603695fff]: 5 changes artifact: c4ae95523c user: dkf
2013-02-07
19:04 Add attachment test.tcl to ticket [3603695fff] artifact: 3b55280ed6 user: taylor_venable
19:04 Ticket [3603695fff] TclOO: varnames incorrect when used from other object method status still Open with 4 other changes artifact: 12e96e69d1 user: taylor_venable
12:04 New ticket [3603695fff]. artifact: 30931ce69a user: taylor_venable

Ticket UUID: 3603695
Title: TclOO: varnames incorrect when used from other object method
Type: Bug Version: current: 8.6.0
Submitter: taylor_venable Created on: 2013-02-07 12:04:39
Subsystem: 35. TclOO Package Assigned To: dkf
Priority: 8 Severity:
Status: Closed Last Modified: 2013-02-09 19:32:28
Resolution: Fixed Closed By: dkf
    Closed on: 2013-02-09 12:32:28
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: 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.

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

taylor_venable added on 2013-02-07 19:04:40:

File Added - 460258: test.tcl

Attachments: