Skip to content
Tcl Source Code Changes To Migrating scripts to Tcl 9
Login

Changes To Migrating scripts to Tcl 9

Changes to "Migrating scripts to Tcl 9" between 2025-02-19 09:38:17 and 2025-09-04 16:16:22

︙
102
103
104
105
106
107
108












109
110
111
112
113
114
115
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127







+
+
+
+
+
+
+
+
+
+
+
+








Thus `string is integer` should not be used for range validation; use explicit range checks. Likewise, `int()` cannot be used for truncation; use explicit masking of high order bits.

Further, the commands `string is entier` and `string is wide` and functions `entier()` and `wide()` are deprecated. Again, use explicit range checks and masking instead.

See [TIP 514](https://core.tcl-lang.org/tips/doc/trunk/tip/514.md).

The prefix "0d" is used to explicitly use decimal numbers.
This is added, if explictly asked on formatting with "%#d":

```
% format "%#d" 128
0d128
```

The tcl 8.6 result for this command is "128".

See [TIP 472](https://core.tcl-lang.org/tips/doc/trunk/tip/472.md).

## Change in variable name resolution

In Tcl 8 variable names that are not absolute, are resolved by looking first in the current namespace, and then in the global namespace. In Tcl 9 such variables are always interpreted as relative to the current namespace.

This avoids the problem that setting a variable inside a namespace scope will overwrite a global variable, if that global variable exists and the variable does not exist relative to the namespace. But it also has some consequences that may not immediately be obvious:

* Access to well-known variables such as env and tcl_platform inside a namespace eval block will need to either fully qualified or the variable must be brought into scope using `namespace upvar` command (`namespace upvar :: env env`).
︙