Skip to content
Tcl Source Code History Of Ticket 559268ffffffffff
Login

History Of Ticket 559268ffffffffff

Artifacts Associated With Ticket 559268ffffffffff

  1. Ticket change [ed9edd96c4] (rid 103919) by dgp on 2002-05-22 16:44:48:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      The documentation of
      
      namespace forget ?pattern ...?
      
      claims that each "pattern" must be a qualified
      name.  That is, it must contain a "::".  It further
      claims that everything to the left of the rightmost
      "::" must be a literal name of an exporting namespace,
      while everything to the right of it can be a pattern
      for matching against exported commands of that
      namespace.
      
      In fact, simple names are permitted as arguments
      to [namespace forget] and that can be quite
      useful.
      
        namespace eval importer {
      namespace import ::exporter::foo
      namespace forget foo
        }
      
      will work fine to undo the import.  In this example,
      it would be just as easy to explicitly repeat
      
      namespace forget ::exporter::foo
      
      but consider the case where the exporting namespace
      is actually an argument passed into a proc, and 
      the [namespace forget] comes at a later time.  It
      would be a real pain to have to store which exporting
      namespace the command was imported from, just so you
      could successfully [namespace forget] it later.
      
      (Hmmm... I guess it's not so bad, becuase
      
      namespace forget [namespace origin foo]
      
      should always work, but why the extra scoping if
      it's not really necessary?)
      
      Anyhow, the simple case does work, so that
      should be documented.
      
      It appears it will even work with a [rename]d
      imported command:
      
      namespace eval importer {
          namespace import ::exporter::foo
          rename foo bar
          namespace forget bar
      }
      
      Someone more familiar with the internals of 
      [namespace] than I am should update the docs, so
      the exact requirements and capabilities can be
      documented correctly.
      
    4. foundin initialized to: "obsolete: 8.4a5"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "dgp"
    9. subsystem initialized to: "21. [namespace]"
    10. title initialized to: "incorrect [namespace forget] docs"
    11. type initialized to: "Bug"
  2. Ticket change [70e1f24396] (rid 100568) by msofer on 2002-05-23 03:33:12:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Indeed, the docs are misleading. It almost seems that the
      usage of unqualified names is the only safe way to
      [namespace forget] an imported command, as shown in the
      following:
      
      % namespace eval tst0 {proc a {} {puts hello}}
      % namespace eval tst0 {namespace export a}
      %  namespace eval tst1 {namespace import ::tst0::a}
      % tst1::a
      hello
      % namespace eval tst0 {rename a b}
      % namespace eval tst1 {rename a c}
      % tst1::c
      hello
      % # cannot forget using the original import name
      % namespace eval tst1 {namespace forget ::tst0::a}
      %  tst1::c
      hello
      % # cannot forget using the current name of the imported proc
      %  namespace eval tst1 {namespace forget ::tst0::b}
      % tst1::c
      hello
      % # cannot forget using the current local name and the
      exporter's path
      % namespace eval tst1 {namespace forget ::tst0::c}
      %  tst1::c
      hello
      % # forget only using the current local name
      % namespace eval tst1 {namespace forget c}
      % tst1::c
      invalid command name "tst1::c"
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  3. Ticket change [98c533a4f5] (rid 110669) by msofer on 2002-05-23 05:14:48:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      RFC: Should I document the current behaviour, or rather
      adapt behaviour to the docs? Or both?
      
      The current behaviour is:
      
      1. If the cmd name (or pattern)  is qualified, check for
      existence of a corresponding command in the NS given by the
      qualifier, and remove same-named commands in the local
      namespace if they are imported commands (even if imported
      from somewhere else, see example below)
      
      2. If the cmd name (or pattern) is simple, remove the
      corresponding commands in the local namespace if they are
      imported commands
      
      Prop.1 is (almost) the documented behaviour; Prop.2 is not
      documented - but really useful. So: document and fix 1?
      
      Prop.1 looks buggy and dangerous to me (as implemented): you
      can 'forget' a command imported from somewhere else! Example:
      
      % 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. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  4. Add attachment "NSforget.diff" [4872031c0b] (rid 99884) by msofer on 2002-05-25 02:59:45.

  5. Ticket change [e5e7e04bc5] (rid 104208) by msofer on 2002-05-25 02:59:45:

    1. icomment:
      
      
      File Added - 23696: NSforget.diff
      
      Logged In: YES 
      user_id=148712
      
      Attaching a patch to the docs.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  6. Ticket change [ab4967212e] (rid 101075) by msofer on 2002-05-25 03:20:42:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      The funny behaviour of [namespace forget] is the subject of
      [Bug #560297]; this ticket here concerns only the
      undocumented behaviour for simple names.
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  7. Ticket change [22513efb77] (rid 130726) by msofer on 2002-06-04 00:05:18:

    1. closedate changed to: "2002-06-03T17:05:18"
    2. closer changed to: "msofer"
    3. resolution changed to: "Fixed"
    4. status changed to: "Closed"