Author: Jan Nijtmans <[email protected]> State: Final Type: Project Vote: Done Created: 4-Nov-2020 Post-History: Keywords: package Tcl-Version: 8.7 Tcl-Branch: tip-590 Vote-Summary: Accepted 3/0/2 Votes-For: JN, KW, MC Votes-Against: none Votes-Present: FV, SL
This TIP proposes to rename some package names to lowercase, and recommend lowercase packagenames.
Let's run the "package names" command. Possible outcome:
% package names Thread http tcl::tommath TclOO tcl::idna opt tcltest zipfs cookiejar msgcat zlib Ttrace Tcl platform sqlite3 Tk
From this, we cannot really see where those packages came from. Some are distributed from within Tcl (tcl::tommath, zlib, TclOO, zipfs), some are distributed as tm modules (http, msgcat, platform), some are in the battery-included Tcl distribution (Thread, Ttrace, sqlite3).
Further on, on Windows there are 2 packages which' entry points symbols cannot be guessed. The reason is their filenames: "tcldde14.dll" resp. "tclreg13.dll", while their package names are "dde" resp. "registry"
In order to bring some consistency in package names, this TIP proposes to rename some packages. The old package names are kept as well.
- TclOO ⟶ tcl::oo
- zipfs ⟶ tcl::zipfs
- zlib ⟶ tcl::zlib
- Tcl ⟶ tcl
- Tcltest ⟶ tcl::test
- Tk ⟶ tk
- Tktest ⟶ tk::test
This means that both "package require tcl" and "package require Tcl" can be used interchangably. But "package require TCL" won't work. The old names will be deprecated, but not removed, not even in Tcl 9.0.
From now on, the recommended way to name packages is lowercase.
Extend the "load" command, such that if a library name starts with "tcl" (or contains "tcl" just after the starting "lib"), this part will be stripped completely in stead of only the "lib" part. This makes the entry symbol of "tcldde13.dll" guessable.
Rename the directory "reg" to "registry" and the file "tclreg14.dll" to "tclregistry14.dll". This makes the entry point "Registry_Init" guessable from the filename.
The "load" and "unload" command have an optional
which isn't actually a packageName at all. It's more like a prefix, which
is title-cased and appended with "_Init" (or "_Unload") for determining
the initialization function of the loaded library. There's a separate
on that. That's why the "load" and "unload" still use Titlecase
arguments like "Tk", not "tk". Originally, solving this was part
of this TIP, but it's out of scope now: It's not necessary to
make the transition to lowercase package names, so this can be
solved separately later.
The same holds for the packageName argument of the
Tcl_StaticPackage() function, this argument
should still be Titlecase as well.
This is almost 100% compatible with Tcl 8.5/8.6. UPPERCASE or Titlecase package names still work as before. The only possible difference is made in package names starting with "tcl", such as "Tclx". Such packages cannot be "load"ed any more without explicitly naming the "Tclx" prefix. I tested TclX with this change, and it works fine, because it's pkgIndex contains an implicit "Tclx" prefix.
In tcl branch "tip-590". Tk has its "tip-590" branch too.
This document has been placed in the public domain.