Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e93ba08584e2b24b22751885c4e93dab5bff08a7
Ticket: 535709ffffffffffffffffffffffffffffffffff
[package] ctrl over namespace placement
User & Date: muonics on 2002-03-27 13:30:42
Changes

  1. assignee changed to: "dgp"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Allow the "package require" command to take an 
    argument for asserting control over the placement of 
    loaded namespaces that are defined with relative names 
    (ie., not explicitly off the root namespace as 
    in ::MyNamespace).
    
    For example, if you know that a particular package's 
    Tcl code is written in a namespace-placement-safe 
    manner (e.g., through applicable use of "namespace 
    code", etc.), it should be possible to have an 
    application that is using that package place it 
    wherever it wants in the namespace heirarchy, to avoid 
    namespace collision without modifying the source code 
    of the package.
    
    For example, if my application uses two packages that 
    both want to define the namespace "tools", your 
    options are either:
    
    1. Edit the source code to rename their namespaces to 
    e.g. "contrib1::tools" and "contrib2::tools" 
    or "tools1" and "tools2".
    
    2. Use "namespace eval contrib1 { source 
    package1/tools.tcl" (likewise for package 2), instead 
    of the package mechanism.
    
    Instead, it would be useful to use a command such as:
    
    package require package1 -in contrib1
    package require package2 -in contrib2
    
    Then, if package1 and package2 are both written to 
    define the "tools" namespace, they'd automatically be 
    placed within the desired parent namespace.
    
    The following does not work...
    
    namespace eval contrib1 {
        package require package1
    }
    namespace eval contrib2 {
        package require package2
    }
    
    ...because through package ifneeded etc. the files 
    listed in pkgIndex.tcl will be sourced in the global 
    context.
    
    This would be particularly useful in cases where a 
    package contains multiple namespaces, or in re-
    packaging a set of packages as a single package.  In 
    the latter case, some namespace-like heirarchy to 
    package names might also be useful.
    
    
  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: "muonics"
  9. subsystem changed to: "39. Package Manager"
  10. title changed to: "[package] ctrl over namespace placement"
  11. type changed to: "RFE"