Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b2e6c236a43b7dbc5f2493dd6ae80e774b7bfe85
Ticket: 1230597fffffffffffffffffffffffffffffffff
allow [namespace import] of same command
User & Date: dgp on 2005-06-30 21:05:29
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    
    Consider the Tcl script:
    
    namespace eval ::foo {
        proc foo {} {}
        namespace export foo
    }
    namespace eval ::bar {
        namespace import ::foo::foo
    }
    
    This script can only be eval'd
    one time.  (If it's in a file, that
    file can only be [source]d one
    time).
    
    The second attempt will
    throw an error from the
    [namespace import] attempt.
    The error is meant to warn us
    that the [namespace import]
    is overwriting an existing command.
    
    In examples like this one, though,
    that warning is wrong-headed.
    We're "overwriting" an import with
    itself, something perfectly safe.
    
    Worse, the import implementation code
    has all the info it needs to check and
    verify that this is perfectly safe, yet fails
    to do so.
    
    Much, much worse, the existing "fix"
    for this problem is to add "-force" to
    the [namespace import] which loses
    all safety, even that which would be
    useful.
    
    Here's a patch to make [namespace import]
    stop raising errors on "overwrites" of an
    import over itself.  This is obviously a good
    idea.  Less obvious whether a TIP is required.
    
    This patch is all that's needed to fix
    Tk Bug 1230576.
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "dgp"
  9. subsystem changed to: "21. [namespace]"
  10. title changed to: "allow [namespace import] of same command"
  11. type changed to: "RFE"