From: SourceForge.net <no...@so...> - 2012-04-09 17:06:01
|
Bugs item #2712377, was opened at 2009-03-25 11:52 Message generated for change (Comment added) made by dkf You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=2712377&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 07. Variables Group: obsolete: 8.6b1.1 >Status: Closed >Resolution: Fixed Priority: 6 Private: No Submitted By: Christian Nassau (cnassau) Assigned to: Donal K. Fellows (dkf) Summary: info vars doesn't show object variables correctly Initial Comment: The following script behaves badly: oo::class create test { variable foo bar method setvars {f b} { set foo $f set bar $b } method dump1 {} { puts <1> foreach v [info vars *] { puts dump1:$v=[set $v] } } method dump2 {} { puts <2> foreach v [info vars *] { puts dump2:$v=[set $v] } puts foo=$foo } } test create stuff stuff setvars what ever stuff dump1 stuff dump2 The output is <1> <2> dump2:foo=what foo=what I would have expected that [info vars] returns both foo and bar in both dump methods. ---------------------------------------------------------------------- >Comment By: Donal K. Fellows (dkf) Date: 2012-04-09 10:06 Message: Fixed for 8.6; will not backport fix to 8.5 (really a Tcl introspection/resolver issue; can't fix from a package). ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2009-04-17 03:02 Message: The issue is that declared variables that aren't used aren't actually brought into the context. (That's how variable resolvers work.) Arguably the problem is that [info vars] doesn't do a nice job with resolvers in place, and not that TclOO "doesn't work". ---------------------------------------------------------------------- Comment By: Christian Nassau (cnassau) Date: 2009-03-26 12:36 Message: Here's another script that behaves strangely with respect to object variables: oo::class create test { variable foo constructor {foo} { set bar $foo unset foo my variable foo set foo $bar } method dump {} { puts foo=$foo } } test create FOO BAR FOO dump Here "unset foo" fails with "can't unset "foo": no such variable". If that line is commented out the error becomes "variable "foo" already exists" from "my variable foo". I would have hoped that "FOO dump" produces "foo=BAR" in the end. Again this report refers to CVS head (which identifies itself as 8.6b1.1 with TclOO 0.6.1). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=2712377&group_id=10894 |