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 2023-10-30 17:25:13 and 2023-10-31 16:15:42

︙
25
26
27
28
29
30
31
32





33
34
35
36
37
38







39
40
41
42
43
44

45
46
47
48
49
50
51
52
53
54
55

56







57




58
















59
60
61
62
63
64
65
25
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
49
50
51
52
53

54
55
56
57
58
59
60
61
62
63
64
65
66

67
68
69
70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101







-
+
+
+
+
+





-
+
+
+
+
+
+
+





-
+











+
-
+
+
+
+
+
+
+

+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







still done at start up time on environment values containing library
paths (`TCLLIBPATH` and analogous tm path variants).

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

## Octals

TBD
The Tcl 8 intepretation of numeric strings beginning with `0` as octal
representation has been done away with. These are now treated as decimal.
All such uses within a script should instead use the explicit `0o` prefix
for octal notation. Particular care must be taken on input and output
when interacting with programs or users based on the old interpretation.

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

## Underscores in integers

TBD
Tcl 9 allows the use of the `_` underscore character as a separator in
numeric strings, e.g. `1_000_000`, `1_0.0_1`. It is important to note
that this applies not just to literals in source code as in some other
languages but run-time values as well. For example, if the `string is
integer` command is used to validate user input as integers, it will
allow underscores to be entered. If this is not desired, such validation
needs to be changed to use `scan` or regexps.

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

## Changes in integer handling

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

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

## Change in variable name resolution

TBD

Q - has the behavior of `global` changed within namespaces?

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

## Arguments to `load` are Unicode-aware and case sensitive
## Case sensitivity in `load` arguments

In Tcl 8, the second argument to the `load` command which specifies
the initialization function was case-insensitive. This is inconsistent
with the rules for package names which are case-sensitive. In Tcl 9,
initialization function names are now case sensitive. For example,
if the initialization function was called `Sample_Init`, either of the
following commands would work in Tcl 8

```
load sample.dll sample
load sample.dll Sample
```
TBD

In Tcl 9, only the latter would be successful.

If compatibility with both Tcl 8 and 9 is desired, the following
idiom may be used

```
load sample.dll [string toupper sample]
```

Note that instances of the `load` command that do not have the second
argument specified need not be changed.

In addition, Tcl 9 does not restrict the names to ASCII. In practice
this should not have any compatibility issues.


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

## Encoding for `source` command defaults to UTF-8

TBD

︙