TclOO: [self caller]
Closed / Invalid1821332fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-10-27 19:25:21
I don't know if I'm right here:
(tcl85b1 on WinXP with TclOO01)
------------
package require TclOO
oo::class create test {
method selfcaller {} {
puts [self caller]
}
}
set t [test new]
$t selfcaller
------------
Error:
caller is not an object
while executing
"self caller"
(class "::test" method "selfcaller" line 2)
invoked from within
"$t selfcaller"
(file "sample1.tcl" line 12)
I was expecting a list like:
"[list [self class] [self object] [self method]]"
e.g.:
{::test ::oo::Obj4 selfcaller}
dkfplain2007-10-28 05:20:59
Logged In: YES
user_id=79902
Originator: NO
That's because that operation returns information about the *caller* of the method if that's also a method. Thus, If you'd done this:
oo::class create test {
method foo {} { my bar }
method bar {} { puts [self caller]; my destroy }
}
[test new] foo
you might have ended up with output like this:
::test ::oo::Obj6 foo
Returning the other information would have been redundant. :-)
dkf Closed ticket [1821332fff].
[History diff]2007-10-28 05:21:20
Log in (anonymous is fine) to add a comment.