TIP 590: Recommend lowercase Package Names

Login
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

Abstract

This TIP proposes to rename some package names to lowercase, and recommend lowercase packagenames.

Rationale

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"

Specification

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.

Caveat

The "load" and "unload" command have an optional ?packageName? argument, 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 ticket 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.

Compatibility

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.

Reference Implementation

In tcl branch "tip-590". Tk has its "tip-590" branch too.

Copyright

This document has been placed in the public domain.