Allow ':' (';' on Windows) as separator in TCLLIBPATH
Inspired by [1b8a893ded]: Allow ':'/';' in TCLLIBPATH For consistancy with HOME/PATH/TCL_PACKAGE_PATH. Since paths on Windows don't contain ';' and paths on UNIX don't contain ':' (doing that would create other problems), this is an infinitely small **potential incompatibility**
No, no no. Don't change this.
Also, change TCL_PACKAGE_PATH back.
I am confused by this RFE. TCLLIBPATH is documented to have a Tcl list syntax. Is the suggestion to move to a "native" : or ; separated syntax?
Could //zipfs:/myapp/lib reasonably be in TCLLIBPATH requiring the : to be escaped? Just string replacement of : or ; with spaces (in the rfe-3057 branch) on a list and expecting correct list structure to be maintained is frought in my opinion.
If at all any changes are to be made, I am in favour of a broader review of environment variable syntax instead of isolated point changes to specific variables. Choice of platform specific versus Tcl syntax impacts
File path separators in environment variables.
/,\or both?TCLLIBPATHrequires/,TCL_LIBRARY,HOMEandTCL*_TM_PATH(on Windows, dunno about Unix) accepts either.Quoting / escaping. How are spaces or
:in a zipfs path escaped? In the case ofTCLLIBPATHthe\is used for escaping as standard Tcl syntax. In the case ofTCL*_TM_PATH, I am not sure.If the environment variable is a list, what is its syntactic structure? As a Tcl list, or using ":" or ";" in a platform specific manner? Currently
TCLLIBPATHis a Tcl list,TCL*_TM_PATHuses the latter platform specific form.
These are all interrelated, e.g. if using Tcl syntax, then \ cannot be used as a file path separator.
Current behaviour seems to be inconsistent between environment variables, for better or worse. If any changes are to be made, they should not be done in isolation.
The Tcl list format is the best choice for representing data in a platform-agnostic manner. This includes structured data that is stuffed into environment variables. One thing that is underappreciated is that when items in a Tcl list are enclosed in double quotes, with characters in the enclosed value properly escaped, the Tcl list is readable by both Tcl and a Posix shell. That is, it is trivial to write an sh function that produces a Tcl list, and then for either an sh or Tcl interpreter to consume that same list. This is how the list can be consumed in sh:
mylist="\"one two\" \"three four\" \"five six\""
eval set -- $mylist
for i in "$@"; do printf '%s\n' "$i"; done
If Tcl standardizes on using Tcl lists to communicate structured data, each existing and future platform can easily adapt the data to meet its own needs. It also allows the implementation of Tcl itself to remain more simple. When the format of TCL_PACKAGE_PATH was changed recently, the following code was added to parse the foreign format:
https://core.tcl-lang.org/tcl/info/c2a94d79f639037e
Accretions of such add-hoc parsing in the Tcl code base over time are clearly undesirable. Standardizing on Tcl lists offers a way to stay out of such messes.