Tcl Library Source Code

View Ticket
Login
Ticket UUID: 3bb067b6674eb84247a8f473eded22f4681a76e
Title: package load failure
Type: Bug Version: 2.3.1
Submitter: griffin Created on: 2016-04-26 22:26:26
Subsystem: snit Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2016-04-26 22:26:26
Resolution: None Closed By: nobody
    Closed on:
Description:
In snit2.tcl:

namespace eval ::snit:: {
    set library [file dirname [info script]]
}

If the variable ::library exists before executing [package require snit], then the global library will be set, not a namespace variable.  The package will then fail to load:

$ tclsh8.5
% set library "of congress"
of congress
% package require snit
can't read "::snit::library": no such variable
% unset library
% package require snit
2.3.1
% 

The code should read:

namespace eval ::snit {
    variable library [file dirname [info script]]
}