0
votes

According to tcl.tk:

auto_oldpath is a global Tcl variable which is set during the auto_load_index proc.

and

auto_path is one of the magic names that Tcl knows. It is described in the Tcl man page, "library". It is a global variable containing a list of directories that Tcl uses when attempting either to resolve packages with the package command, or to resolve commands using auto_load. The package and auto_load commands use auto_path in different ways. auto_load searches the auto_path directories looking for files named tclIndex. These are "Tcl autoload index files", and are formatted in two versions; version 2.0 contains commands set auto_index(::namespace::function_name) $cmd where $cmd typically sources a file that defines the command ::namespace::function_name

which is for me:

% puts $auto_path
/usr/share/tcltk/tcl8.5 /usr/lib /usr/local/lib/tcltk /usr/local/share/tcltk /usr/lib/tcltk /usr/share/tcltk /usr/share/tcltk/tk8.5/ttk

but:

% puts $auto_oldpath
can't read "auto_oldpath": no such variable
1

1 Answers

1
votes

This variable was moved to the ::tcl namespace.
This variable is set to the value of the ::auto_path variable when the auto_index is build.
It won't try to load the auto_index again if the contents of ::tcl::auto_oldpath is equal to the contents of the ::auto_path variable.

To quote the relevant part of the init.tcl

proc auto_load_index {} {
    variable ::tcl::auto_oldpath
    global auto_index auto_path

    if {[info exists auto_oldpath] && ($auto_oldpath eq $auto_path)} {
        return 0
    }
    set auto_oldpath $auto_path
    # ....
}