From: Hemang L. <hl...@ci...> - 2008-12-11 12:35:36
|
Jan Nijtmans wrote: > 2008/12/11 Jeff Hobbs <je...@ac...>: > >> And I'm annoyed again after finding another uselessly cased package. >> What moron named a package TclOO? Ugh?! Something will need to be done >> about this, and it will be done in ActiveTcl if not the core. >> > > Something can be done about it: I think it would be good that the TCT > starts recommending all lower-case package names. That means that > TclOO should become tcloo (or maybe simply just "oo"), Tcl > should become tcl and Tk should become tk. Providing > compatibility is easy. (For TclOO it is not really an issue, > but because it is available as a separate package > as well, I would do it anyway.) > > How about a mini-TIP, which simply proposes to recommend (but not > require) all-lowercase package names. Then the core should do the > same, just do "package provide" twice, once with the original name, > once with the all-lowercase name. It's zero risk, and still allows > us to come with a better solution in Tcl 8.7. > It's not as simple as doing "package provide" twice when tcl modules are involved. This is how our developers initially started out to support multiple cases for our packages. They had multiple "package provide" statements in their library to support FooBar, foobar and fooBar. However, when we started creating tcl modules for these packages, the "package provide" trick would no longer work. An alternate approach I can think of to resolve this issue is to shift the burden to developers. Let the developer of a package decide whether their package should be registered as case-insensitive or not. For example, introduce a new subcmd say nocase: package nocase FooBar 1.1 Any package registered with nocase subcmd can be loaded by the end user with any case. There would be no need for the end user to specify -strict option. Packages like Tcl, TclOO, BWidget, etc can immediately start including these cmds wherease tcltest and Tcltest can continue to remain case-sensitive. If there are conflicts with package names from two sources, it would be upto the respective developers to sort out or change the name or not use -nocase option. If a tcl module is created for a package, make it a requirement for the developer to register the package as nocase, so that it can avoid potential conflicts with other packages in future. The [package nocase] command can be wrapped in catch to ensure that these pkgs can be used in older tcl versions as well. Hemang. |