Menu

#4806 namespace code simplification incorrect

obsolete: 8.5.9
closed-fixed
5
2011-03-09
2011-03-07
Don Porter
No

Demo script:

% namespace eval demo {
proc namespace args {puts $args}
::namespace code {namespace inscope foo}
}
namespace inscope foo

[::namespace code] tries to detect and simplify cases where
it would produce nested [::namespace inscope] calls. In the
case where a namespace has its own custom "namespace"
command, though, this is not correct.

Discussion

  • Don Porter

    Don Porter - 2011-03-07

    There is also a more fundamental design flaw
    that the functioning of [namespace code] appears to
    rely on an assumption that the [::namespace] command
    is never [rename]d.

     
  • Don Porter

    Don Porter - 2011-03-07

    Since there's no way I can think of to deal with the
    possibility of the renaming of commands between the
    time [namespace code] quotes a script, and the time
    the quoted script is eval's by a callback operation, that
    weakness may just have to be accepted. The bug demo
    submitted ought to be fixable though.

     
  • Don Porter

    Don Porter - 2011-03-08

    Note, this analysis also implies that
    tests namespace-22.2 and namespace-22.3
    are incorrect.

     
  • Don Porter

    Don Porter - 2011-03-09

    Fix is in checkin

    http://core.tcl.tk/tcl/info/ac4c249ecf

    Please review, and if acceptable, either merge
    to core branch, or give me the ok to do so.

     
  • Don Porter

    Don Porter - 2011-03-09
    • assigned_to: dgp --> dkf
     
  • Donal K. Fellows

    Looks OK to me

     
  • Donal K. Fellows

    • assigned_to: dkf --> dgp
     
  • Don Porter

    Don Porter - 2011-03-09

    committed.

     
  • Don Porter

    Don Porter - 2011-03-09
    • status: open --> closed-fixed