2024年9月26日,Tcl核心团队宣布Tcl/Tk 9.0正式版发布了。9.0是tcl和tk的大版本更新,距tcl8.6首次发布,2012年,已过去12年。我们来一起看看有哪些新功能。
64-bit容量: 数值最大支持2Gb
文字的国际化
Full Unicode range of codepoints
New encodings: utf-16(le|be), ucs-2(le|be), CESU-8, etc.
[encoding] options -profile, -failindex manage encoding of I/O.
[msgcat] supports custom locale search list
[source] defaults to -encoding utf-8
Zip文件和压缩格式附件
epoll()或kqueue()的Unix通知
relieves limits on file descriptors imposed by legacy select()
与旧版本主要不兼容
Unqualified varnames resolved in current namespace, not global.
No --disable-threads build option. Always thread-enabled.
I/O malencoding default response: raise error (-profile strict)
Windows platform needs Windows 7 or Windows Server 2008 R2 or later
Ended interpretation of ~ as home directory in pathnames
Removed the "identity" encoding
$::tcl_precision no longer controls string generation of doubles
Removed Tcl 7 legacies: [case], [puts] [read] variant syntaxes
Removed subcommands [trace variable|vdelete|vinfo]
C语言接口的不兼容
Many arguments expanded type from int to Tcl_Size
Ended support for Tcl_ChannelTypeVersion less than 5
Introduced versioning of the Tcl_ObjType struct
Removed macros CONST*: Tcl 9 support means dropping Tcl 8.3 support
Removed routines:
Tcl_Backslash(), Tcl_VA(), Tcl_MathFunc*(), Tcl_MakeSafe(),
Tcl_(Save|Restore|Discard|Free)Result(), Tcl_EvalTokens(),
Tcl_(Get|Set)DefaultEncodingDir(),
Tcl_UniCharN(case)cmp(), Tcl_UniCharCaseMatch()
新命令
[array default], [array for]
[coroinject], [coroprobe]
[clock add weekdays]
[const], [info const*]
[dict getdefault]
[file tempdir], [file home], [file tildeexpand]
[info commandtype]
[ledit]
[lpop]
[lremove]
[lseq]
[package files]
[string insert], [string is dict]
[tcl::process]
命令的新参数
[regsub ... -command ...]
[lsearch ... -stride ...]
[socket ... -nodelay ... -keepalive ...]
[vwait] controlled by several new options
数字
0NNN format is no longer octal interpretation. Use 0oNNN.
0dNNNN format to compel decimal interpretation.
NN_NNN_NNN, underscores in numbers for optional readability
Functions: isinf() isnan() isnormal() issubnormal() isunordered()
[fpclassify]
Function int() no longer truncates to word size
tcl::oo
private variable and methods
[method -export], [method -unexport]
平台相关的方面改进了很多
Built-in widgets and themes are scaling-aware.
Improved support of two-finger gestures, where available
The [tk windowingsystem] "aqua" needs macOS 10.10 or later
新命令和新参数
[tk sysnotify]: access to the OS notifications system
[tk systray]: access to the OS tray facility
[tk print]: access to the OS printing facility
Widget选项
New ttk::progressbar option: -text
[$frame ... -backgroundimage $img -tile $bool]
[$menu id], [$menu add|insert ... ?$id? ...]
[$image get ... -withalpha ...]
widget外观改进
ttk::notebook with nondefault tab positions
图像
Partial SVG support
Read/write access to photo image metadata
Tcl/Tk 9.0源码https://www.tcl.tk/software/tcltk/download.html,可以从源码编译安装。
第三方预编译的二进制版本可以关注这个页面,跟踪第三方的发布:https://www.tcl-lang.org/software/tcltk/bindist.html
我们还记得2015年发布了perl6,但似乎快十年过去了,perl6仍然没有流行起来。tcl9是否会布perl6的后尘,我们将持续关注。