Skip to content
Tcl Source Code History Of Ticket 560297ffffffffffffffffffffffffffffffffff
Login

History Of Ticket 560297ffffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 560297ffffffffffffffffffffffffffffffffff

  1. Ticket change [4848637782] (rid 99858) by msofer on 2002-05-24 20:18:14:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      As documented in [Bug #559268], the behaviour of
      [namespace forget] is somewhat surprising:
      
      (1)  it may forget a command imported from a different
      namespace
      
      % namespace eval src0 {proc a {} {puts 0}}
      % namespace eval src0 {namespace export a}
      % namespace eval src1 {proc a {} {puts 1}}
      % namespace eval tst {namespace import ::src0::a}
      % tst::a
      0
      % namespace eval tst {namespace forget ::src1::a}
      % tst::a
      invalid command name "tst::a"
      
      (2)  it fails to forget an imported command if it was
      renamed
      
      % namespace eval src {proc a {} {puts 1}}
      % namespace eval src {namespace export a}
      % namespace eval dst {namespace import ::src::a}
      % namespace eval dst {rename a b}
      % dst::b
      1
      % namespace eval dst {namespace forget ::src::a}
      % dst::b
      1
      
      
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "msofer"
    9. subsystem initialized to: "21. [namespace]"
    10. title initialized to: "[namespace forget] matches by name only"
    11. type initialized to: "Bug"
  2. Ticket change [e017ad1d6a] (rid 115136) by msofer on 2002-05-25 04:15:40:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Kevin Kenny spotted another problem:
      
      (3) it may remove a command that was *not* imported into the
      current namespace:
      
      % namespace eval src {proc a {} {puts 1}}
      % namespace eval src {namespace export a}
      % namespace eval dst {namespace import ::src::a}
      % namespace eval dst1 {}
      % namespace eval dst {rename a ::dst1::b}
      % dst1::b
      1
      % namespace eval dst1 {namespace forget b}
      %  dst1::b
      invalid command name "dst1::b"
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  3. Ticket change [b2899964c0] (rid 98349) by dgp on 2003-10-03 04:35:47:

    1. priority changed to: "8"
  4. Ticket change [e0763ccc72] (rid 115200) by dgp on 2003-11-13 08:36:55:

    1. foundin changed to: "obsolete: 8.4a4"
  5. Ticket change [42801e0395] (rid 116395) by dgp on 2004-08-28 05:08:27:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      It is the function of [namespace forget]
      to delete imported command(s)
      from the current namespace of the interp,
      based on pattern arguments.
      
      An "imported command" is any for
      which {$cmd ne [namespace origin $cmd]}.
      
      Simple patterns (no namespace separator)
      should match against simple names of
      imported commands and delete those
      that match.  This means problem (3)
      isn't really a problem at all.  Whether the
      imported command got into the current
      namespace via [namespace import] or
      [rename] shouldn't really matter.
      
      For namespace qualified patterns, the
      apparent intent is to control deletion
      of import command based on where
      they point to.  Based on that, is seems
      the correct behavior is to loop over the
      imported commands in the current
      namespace, determine the [namespace origin]
      of each, and match that against the qualified
      pattern.  That algoritthm would correct
      problems (1) and (2).
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [d2b47299fd] (rid 113575) by dgp on 2004-08-31 20:28:51:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      Refinement of the definition:
      
      An "imported command" is any
      for which
      [namespace which -command $cmd]
      and
      [namespace origin $cmd]
      produce different results.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  7. Ticket change [cc10a59acb] (rid 95627) by dgp on 2004-08-31 22:36:21:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      here's a patch that implements
      the outline posted before.
      
      One wrinkle: namespace-old-9.14 fails.
      
      NOTE: Patch 1019718 is included
      in the attached patch.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  8. Add attachment "560297.patch" [9cf2d406c8] (rid 96230) by dgp on 2004-08-31 22:36:23.

  9. Ticket change [5adee6c443] (rid 118221) by dgp on 2004-08-31 22:36:23:

    1. icomment:
      
      
      File Added - 99853: 560297.patch
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  10. Ticket change [1aa00b5b8f] (rid 123011) by dgp on 2004-08-31 23:18:22:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      the failing test raises the question
      of how to forget import chains.
      
      % namespace eval origin {  
          namespace export cmd
          proc cmd args {}
      }
      % namespace eval link {
          namespace export cmd
          namespace import origin::cmd
      }
      % namespace eval unrelated {
          namespace export cmd
          proc cmd args {}
      }
      % namespace eval my namespace import ::link::cmd
      
      At this point, in an unpatched Tcl, any of
      the following commands in namespace "my"
      will forget my::cmd :
      
      namespace forget ::origin::cmd
      namespace forget ::link:::cmd
      namespace forget ::unrelated::cmd
      
      The last is case (1) in the bug report.
      
      After the attached patch is applied,
      only
      
      namespace forget ::origin::cmd
      
      will work.
      
      The test fails because it would
      expect that
      
      namespace forget ::link::cmd 
      
      would also work, and that has
      some intuitive appeal as well,
      as that is really the command
      that was imported.
      
      So we have some options
      how to deal with the links in
      an import chain:
      
      1) forget based only on the origin.
        - what the patch does
      2) forget based only on the first link
        - closer in intuition to being the
          inverse of a [namespace import]
      3) Both 1) and 2)
        - allow forgetting by either 1st or last
      4) forget based on any link in the chain at all
      
      Advantage of 1) is that it means
          [namespace forget [namespace origin $cmd]]
      is always a reliable operation.
      Advantage of including 2) as well is that
      there will be no failing tests, and it's
      more intuitive
      So, I think I like 3)
      
      Should probably be said that this whole
      realm is likely best avoided by using
      [namespace forget $simpleName]
      whenever possible.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  11. Ticket change [6b3219bf67] (rid 128278) by dgp on 2004-09-01 00:07:07:

    1. icomment:
      
      
      File Added - 99875: 560297-3.patch
      
      Logged In: YES 
      user_id=80530
      
      New patch implements 
      option 3)
      
      no more failed tests.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  12. Add attachment "560297-3.patch" [6dc79b8fa3] (rid 128759) by dgp on 2004-09-01 00:07:07.

  13. Ticket change [a7c3e9b03b] (rid 98863) by dgp on 2004-09-09 22:44:51:

    1. assignee changed to: "dgp"
    2. closedate changed to: "2004-09-09T15:44:51"
    3. closer changed to: "dgp"
    4. icomment:
      Logged In: YES 
      user_id=80530
      
      Patch -3 committed along with some
      new tests.  commit to HEAD and 8.4 branch.
      
      
    5. login: "dgp"
    6. mimetype: "text/plain"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"
    9. username: "dgp"