New feature in #Tcl9 – part 34:

socket ... -nodelay ... -keepalive ...

Network sockets can now be configured to set or query the TCP keepalive and nodelay options on the socket. Hmm, I have no useful example of this as I haven't actually used `socket` ...

New feature in #Tcl9 – part 33:

regsub -command ... — Generate the replacement for a regular expression by calling a command

Sometimes, a simple `regsub` is not good enough. You may need to do more than just substituting matches into placeholders. That is what the new `-command` option is good for. You can provide a command that takes the matches (substrings) and does with them want you want to happen!

New feature in #Tcl9 – part 32:

lsearch ... -stride ... — Search a list by groups of items

[lsearch ...] is powerful. For flat lists, the -stride option in Tcl 9 can kind of pretend that your list is "nested". In fact, it groups a number of items and treat them as a unit:

lsearch -stride 3 {a A amen b B bank c C citron} c
6

Here, each three elements "a a amen", "b B bank" and so on are regarded as one group. Together with the `-index` option, you can search in any group element!

New feature in #Tcl9 – part 31:

info loaded ... ?prefix?

With [info loaded], you get a list of all files in an interpreter that have been loaded into Tcl using the [load] command. When you are only looking for the file name of a specific prefix, use the new "prefix" option:

Here's an example when looking for the Tdom prefix in the main interpreter:

% info loaded {} Tdom
/Users/auser/Library/Tcl/tdom/lib-tcl9-tdom0.9.3.dylib

New feature in #Tcl9 – part 30:

clock scan ... -validate ...

With Tcl 8.6 you could just write `clock scan 2026-01-34` and Tcl would spit out "1770044400" which is equivalent to "Tue Feb 03 00:00:00 JST 2026". But maybe, you want to avoid such invalid dates in the first place. Who says I meant Feb3? It could have been a type from a user?

This is now possible with the `-validate` option. If true (and this is the default now), you will get an "invalid day" error. Very convenient!

New feature in #Tcl9 – part 29:

chan configure ... -inputmode ... — Support for raw terminal input and reading passwords

Serial ports are dead? No, they get even better! With Tcl 9, you can now set the `-inputmode` option to "normal", "password", "raw" or "reset". For example, `-inputmode password` disables echoing input which is useful for ... well, passwords. Note, this is not documented on the "chan" manual page but on the "open" page ...

New feature in #Tcl9 – part 28:

tcl::idna::* — working with encoded DNS names

IDNA is "Internationalizing Domain Names in Applications". You can use it to convert between #Unicode and ASCII representations using #punycode.

Such URLs look like this: www.xn--Tcl-ist-s-o1a23a.de

New feature in #Tcl9 – part 27:

readFile, writeFile, foreachLine — simple procedures for basic working with files

Before Tcl 9, you had to write your own file reading and writing procedures. Tcl 9 makes life a bit easier by proving some to you. E.g., you can now write:

foreachLine myVar /Users/me/Documents/myfile.txt {
if {[string length $myVar]} {puts $myVar}
}

to write out every non-empty line of a file. Image the possibilities!

New feature in #Tcl9 – part 26:

*::build-info — Obtain information about the build of Tcl

Here is something for coders who want or need to look deeper into packages. This command is only defined when a package explicitly fills this info in. Tcl and Tk now do so. You can thus try:

tcl::build-info
9.0.3+a527703e8829e0c3d27188dff72627dc0914d9c0cc9d4acfac297b78fff01081.clang-1500.tommath-0103

and this is what you might get. Similar for `tk::build-info`.

New feature in #Tcl9 – part 25:

tcl::process — Commands for working with subprocesses

This is a very useful new command. It allows subprocesses that have been started from Tcl's [open] or [exec] commands to be managed using their PIDs (process identifiers). This comes in handy to check the status of such a running subprocess or purging them after termination.