Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4a98e739090c3613b1a8cd6fc004a95882bb190f
Ticket: 218451ffffffffffffffffffffffffffffffffff
Bug in pkg_mkIndex and namespaces
User & Date: nobody on 2000-10-26 01:00:33
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 573 Bug
    Version: 8.0p2
    SubmitDate: '1998-05-21'
    LastModified: '1999-08-15'
    Severity: LOW
    Status: Released
    Submitter: hershey
    ChangedBy: hobbs
    OS: Solaris
    OSVersion: 2.6
    Machine: NA
    FixedDate: '1999-08-15'
    FixedInVersion: 8.2
    ClosedDate: '2000-10-25'
    
    
    Hi folks, try this...
    
    1. Save this to test.tcl:
    
    package provide x 1.0
    namespace eval A {
            namespace export b
            proc b {} {}
    }
    namespace import A::b
    
    2. In tclsh8.0 do this...
    % source test.tcl
    % exit
    
    3. So far so good. Now restart tclsh and try this
    % pkg_mkIndex . test.tcl
    error while loading or sourcing test.tcl: can't import command
    "b":
    already exists
    %
    
    Any idea why? seems like it should be OK to me: The file defines
    two
    commands, "A::b" and "b"
    
    What I'm trying to do is hide (well, "obfuscate" is probably more
    accurate I guess) all the implementation details of a package in a
    
    namespace, and then import a few of the procs into the global
    namespace.
    I can think of some work arounds, but basically they involve
    writing a
    proc in the global namespace that uses variables from the
    package's
    namespace, and it would be tidier if I could just use 'variable
    whatever' when I wanted to do this.
    
    Details: tcl 8.0p2, Solaris 2.6
    Thanks.
    ---------------------------------------------------------------
    David Houlder                             Phone: (06) 249 0668
    Centre for Resource and Environmental Studies  (+61 6 249 0668)
    The Australian National University         Fax: +61 6 249 0757
    
    
    
    This works in 8.2, although maybe not as desired.  Before 8.0.5,
    there was a -verbose switch created to prevent the error, but
    the indexing wouln't work, because of the use of namespace import
    without the -force switch in the pkg_mkIndex command.  Adding this
    (which was done before 8.2) will make it work.  However, in this
    automation, the procs are still recognized in their qualified
    state.  So ::A::b will be put in the pkgIndex.tcl file, not 'b'.
    The user may want to edit the pkgIndex.tcl file by hand in this
    case. 
    -- 08/15/1999 hobbs
    
  4. foundin changed to: "obsolete: 8.0p2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "Bug in pkg_mkIndex and namespaces"
  11. type changed to: "Bug"