Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2025-05-09
09:48 • Ticket [1b8a893ded] TCL_PACKAGE_PATH path is (wrongly) braced. status still ... artifact: 3630a0d815 user: pooryorick
08:31 • Ticket [1b8a893ded]: 3 changes artifact: cb91339e41 user: jan.nijtmans
06:07 • Open ticket [1b8a893ded]. artifact: 07417c7e73 user: pooryorick
2024-10-19
08:49 • Ticket [3057b6261f] Allow ':' (';' on Windows) as separator in T... artifact: e4d1d6bcb5 user: pooryorick
03:48 • Ticket [3057b6261f]: 3 changes artifact: 0c348e70b2 user: apnadkarni
2024-10-15
19:19 • Ticket [3057b6261f]: 3 changes artifact: 58e36a43ab user: pooryorick
19:18 • Ticket [3057b6261f]: 3 changes artifact: aad6db4b62 user: pooryorick
12:31
Allow tcl_platform(pathSeparator) to be used in TCLLIBPATH. See [3057b6261] check-in: 79a1a6d628 user: jan.nijtmans tags: rfe-3057b6261
12:28 • New ticket [3057b6261f] Allow ':' (';' on Windows) as separator ... artifact: adb3421433 user: jan.nijtmans

Allow ':' (';' on Windows) as separator in TCLLIBPATH

Open3057b6261f7b7ac748fee8c2915c516d2bf05ffaCreated 2 years agoUpdated 2 years ago
Descriptionplain2024-10-15 12:28:56
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**
pooryorickwiki2024-10-15 19:18:35

No, no no. Don't change this.

pooryorickwiki2024-10-15 19:19:38

Also, change TCL_PACKAGE_PATH back.

apnadkarnimarkdown2024-10-19 03:48:09

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? TCLLIBPATH requires /, TCL_LIBRARY, HOME and TCL*_TM_PATH (on Windows, dunno about Unix) accepts either.

  • Quoting / escaping. How are spaces or : in a zipfs path escaped? In the case of TCLLIBPATH the \ is used for escaping as standard Tcl syntax. In the case of TCL*_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 TCLLIBPATH is a Tcl list, TCL*_TM_PATH uses 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.

pooryorickwiki2024-10-19 08:49:17

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.

Log in (anonymous is fine) to add a comment.