Skip to content
Tcl Source Code Update of ”Migrating scripts to Tcl 9”
Login

Update of ”Migrating scripts to Tcl 9”

Overview

Artifact ID: e188065de6248d928ea514264cef81cbd9ef82f3e035e3b7a2066ccf3ca52a09
Page Name:Migrating scripts to Tcl 9
Date: 2023-10-30 17:25:13
Original User: apnadkarni
Mimetype:text/x-markdown
Parent: 9981c49484fb04ca1735239b2b6a06ead2b3d4671499257351eba63e8e48b11c (diff)
Next 2e8dc19be427b6b550160a3a0a0f662390cd2e01b76eeba905d819f5d60d1018
Content

Work in progress... Currently focused on incompatibilities. Possibly hints on improving scripts making use of new facilities could be added at some point

Strict encoding

TBD - pending CFV on TIP 657, 653 etc.

Tilde substitution

File path arguments in Tcl 8 would be subject to tilde substitution where ~ and ~USER prefixes in the path would be replaced with the home directory of the current or named user respectively. Although convenient for interactive use, this behavior lead to both security and robustness issues as documented in TIP 602.

Tcl 9 therefore no longer does this substitution and scripts must explicitly do the same if desired with the new commands file home and file tildeexpand. Conversely, commands that had to protect against this treatment of ~ by prefixing with ./ (glob, file split etc.) will no longer to do so. Scripts that had their own workarounds to protect against tilde substitution no longer need to do so.

As an exception for convenience for end users, tilde substitution is still done at start up time on environment values containing library paths (TCLLIBPATH and analogous tm path variants).

See TIP 602.

Octals

TBD

See TIP 114.

Underscores in integers

TBD

See TIP 551.

Changes in integer handling

int() does not truncate, string is integer same as entier etc.

See TIP 514.

Change in variable name resolution

TBD

Q - has the behavior of global changed within namespaces?

See TIP 278.

Case sensitivity in load arguments

TBD

See TIP 595.

Encoding for source command defaults to UTF-8

TBD

See TIP 587.

Full Unicode support

TBD - change in behavior of string length etc. for surrogate pairs

See TIP 497.

Traces on upvars linked to arrays

In Tcl 8, traces set on an array would not fire when an element of the array was modified through an upvar link. This documented but incongruent behavior is fixed in Tcl 9. Array traces will fire even when the element is accessed through an upvar link.

See TIP 634.

glob no longer raises an error if no files match

In Tcl 9, the glob command returns an empty list if no files match the specified pattern instead rasiing an error. This is true irrespective of the presence of the -nocomplain option which is still accepted but has no significance. Any scripts that expect an error to be raised in such cases will need to be modified to check for an empty list instead.

See TIP 637.

Deprecated trace subcommands variable, vdelete, vinfo have been removed

These commands have been deprecated since Tcl 8.4 and have been removed from Tcl 9. Scripts making use of these should be modified as below:

See TIP 673.

Removal of tcl_precision

TBD

See TIP 488.

TBD - build modes, auto_path changes, cannot use auto_path to install packages etc.