something in cmd name caching is very wrong
Closed / Fixed3185407fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2011-02-18 02:34:01
In tclsh 8.6 (close to CVS HEAD)
% namespace eval ns {proc foo {} {}}
% namespace eval ns2 {proc foo {} {}}
% namespace path {ns ns2}
% namespace which foo
::ns::foo
% proc foo {} {}
% namespace which foo
::ns::foo
invoking [foo] does in fact invoke ::foo, not ::ns::foo
And retrying from scratch, without the first [namespace which foo] returns ::foo
% namespace eval ns {proc foo {} {}}
% namespace eval ns2 {proc foo {} {}}
% namespace path {ns ns2}
% proc foo {} {}
% namespace which foo
::foo
Sounds like some cache not being invalidated ?
/Ashok
msoferplain2011-05-08 19:24:02
Bug is in 8.5 too
msoferplain2011-05-08 19:37:48
Problem seems to happen only at the interactive shell. It is NOT a problem with [namespace which], as shown by:
% namespace eval ns {proc foo {} {puts [namespace current]}}
% namespace eval ns2 {proc foo {} {puts [namespace current]}}
% namespace path {ns ns2}
% puts [namespace which foo]
::ns::foo
% proc foo {} {puts [namespace current]}
% puts [namespace which foo]
::ns::foo
% foo
::
% eval [list foo]
::ns
msoferplain2011-05-08 20:01:53
Possible fix in branch bug-3185407. Assigning to the real NS expert for review (if approved, can commit and merge to trunk too)
dkfplain2011-05-09 22:39:27
There does seem to be a performance hit, but I've yet to determine whether it matters (or even if it is a real effect or a nasty confounding cache problem on my machine).
dkfplain2011-06-01 21:58:17
Despite the fact that I find it hard to grok just what's going wrong (or rather why it goes wrong in some places but not others) I still approve the change from bug-3185407; I can't see that it is wrong and it does appear to fix the problem. Performance impact appears minimal.
dkfplain2011-06-02 21:58:26
Fix applied to relevant mainline branches, including a test (derived from bug report; thanks!)
dkfplain2011-06-02 21:58:27
allow_comments - 1
Log in (anonymous is fine) to add a comment.