CINXE.COM
Tcl/Tk 9.0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Tcl/Tk 9.0</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="/devsite.css" type="text/css" media="all"> </head> <body bgcolor="white" text="black"> <table border="0" cellpadding="0" cellspacing="0" width="780"> <tr> <td valign="top" align="left"><a href="/"><img src="/images/plume.png" width="60" height="55" border="0" alt="Tcl Home" /><img src="/images/Developer.gif" width="355" height="55" border="0" alt="Tcl Home" title="Tcl Developer Xchange" /></a></td> <td valign="top" align="right"><a href="/siteinfo.html"><font size=1>Hosted by</font></a><br><a href="http://www.ActiveState.com/products/tcl"><img src="/images/aslogo.gif" border="0" alt="ActiveState" title="This site is hosted by ActiveState" /></a></td> </tr> </table> <div id="globalnav"><ul> <li><a href="/">HOME</a></li> <li><a href="/about/">ABOUT TCL/TK</a></li> <li><a href="/software/tcltk/" class="here">SOFTWARE</a></li> <li><a href="/community/coreteam/">CORE DEVELOPMENT</a></li> <li><a href="/community/">COMMUNITY</a></li> <li><a href="/doc/">DOCUMENTATION</a></li> </ul></div> <br clear="all" /> <DIV style="border-top: 2px solid #3163CE; width: 780px"></DIV> <table border="0" cellpadding="2" cellspacing="0" width="780"> <tr><td align="left" valign="middle"> <!-- SiteSearch Google --> <div style="display:table-cell; vertical-align:middle; margin:0px"> <FORM method="GET" action="https://www.google.com/search"> <A HREF="https://www.google.com/"><IMG src="/images/Search.gif" border="0" ALT="Google SiteSearch" /></A> <INPUT TYPE="text" name="q" size="20" maxlength="255" value=""> <INPUT type="image" value="submit" name="btnG" src="/images/Go.gif"> <input type="hidden" name="ie" value="UTF-8"> <input type="hidden" name="oe" value="UTF-8"> <input type="hidden" name="domains" value="tcl.tk"> <input type="hidden" name="sitesearch" value="tcl.tk"> </FORM></div> <!-- SiteSearch Google --> </td><td align="right"><p class="banner">Tcl/Tk 9.0</p></td></tr></table> <DIV style="border-top: 1px solid #FFCE00; margin-bottom: 2px; width: 780px"></DIV><table border="0" cellpadding="0" cellspacing="0" width="780"> <tr><td> <p> <img src="/images/Tcl9.png" width="20%" align="right"> <B>Latest Release: Tcl/Tk 9.0.1 (Dec 20, 2024)</B> <p> Tcl/Tk 9.0 is the latest major release of both Tcl and Tk. It features many new capabilities, and presents some incompatibilities with Tcl/Tk 8. <p class="biglink"> <a href="download.html">Download Tcl/Tk 9.0.1 Source Releases</a> </p> <h3>Highlights of Tcl 9.0</h3> <ul> <li> <b>64-bit Capacity:</b> Data values larger than 2Gb <li> <b>Unicode and Encodings:</b> full codepoint range, added encodings, <A HREF="https://www.tcl-lang.org/man/tcl9.0/TclCmd/encoding.html#M14"> encoding profiles </A> to govern I/O, and more. <li> <b>Zip Filesystems:</b> <A HREF="https://www.tcl-lang.org/man/tcl9.0/TclCmd/zipfs.html"> mount zipfiles </A> as filesystems <li> <b>Attached Archives:</b> enable starkit-style deployment of apps, with support data in filesystem archives attached to executable or libraries. Build tclsh and wish this way. <li> <b>New Notifiers:</b> The central event handling engine in Tcl is now constructed on top of the system calls <b>epoll</b> or <b>kqueue</b> when they are available. The <b>select</b> based implementation also remains for platforms where they are not. <li> <b>Many new commands and features</b> </ul> See <a href="#tclchanges">below</a> for a more complete summary of changes in Tcl. <h3>Important Incompatibilities in Tcl 9.0</h3> <ul> <li> <b>Namespace varname resolution:</b> Current namespace, not global. <li> <b>I/O malencoding:</b> now raises error by default. <li> <b>Tilde (~) in pathnames:</b> no longer interpreted as home directory. <li> <b>tcl_precision</b> no longer has effect on number formatting </ul> <h3>Highlights of Tk 9.0</h3> <ul> <li> <b>Access to OS facilities:</b> <A HREF="https://www.tcl-lang.org/man/tcl9.0/TkCmd/tk.html#M12"> notifications </A>, <A HREF="https://www.tcl-lang.org/man/tcl9.0/TkCmd/tk.html#M12"> print </A>, and <A HREF="https://www.tcl-lang.org/man/tcl9.0/TkCmd/tk.html#M13"> tray </A> systems <li> <b>Scalable Vector Graphics:</b> partial support in images, extensive use to enable scalable widget and theme appearances. <li> <b>Images:</b> full access to <A HREF="https://www.tcl-lang.org/man/tcl9.0/TkCmd/photo.html#M11"> metadata </A> and alpha channel. <li> <b>Platform Features and Conventions:</b> many improvements, including two-finger gesture support where available. </ul> See <a href="#tkchanges">below</a> for a more complete summary of changes in Tk. <h3>Porting code to Tcl 9</h3> <p>Many Tcl programs written for Tcl 8 will run unchanged in Tcl 9. Many more Tcl programs can be modified in small and simple ways to produce a new program that runs in both Tcl 8 and Tcl 9. Extensions and applications using the public Tcl C APIs will involve more effort, but it is still within reasonable reach to produce source code supporting both Tcl 8 and Tcl 9 while both releases remain in widespread use.</p> <p>Tk 9.0.0 does not support Tcl 8.6. Tk 9.0.0 extends Tcl 9.0.0. To make use of Tk 9.0.0, first the new Tcl release, Tcl 9.0.0, needs to be present. As new Tk features are developed, expect them to appear in Tk 9, but not necessarily in Tk 8.6.</p> <p>See the following links for an accumulation of migration advice:</p> <ul> <li><a href="https://core.tcl-lang.org/tcl/wiki?name=Migrating+C+extensions+to+Tcl+9">Migrating C extensions to Tcl 9</a></li> <li><a href="https://core.tcl-lang.org/tcl/wiki?name=Migrating+scripts+to+Tcl+9">Migrating scripts to Tcl 9</a></li> </ul> <p>There has been much progress already porting many known applications, extensions, and packages in the Tcl world to compatibility with Tcl/Tk 9:</p> <ul> <li><a href="https://wiki.tcl-lang.org/page/Apps+confirmed+to+work+with+Tcl+9">Apps confirmed to work with Tcl 9</a></li> <li><a href="https://wiki.tcl-lang.org/page/Porting+extensions+to+Tcl+9">Porting extensions to Tcl 9</a></li> </ul> <h3 id="tclchanges">Summary of changes for Tcl</h3> <h4>Major Features</h4> <ul><li>64-bit capacity: Data values larger than 2 GB</li> <ul> <li>Strings can be any length (that fits in your available memory)</li> <li>Lists and dictionaries can have very large numbers of elements</li> </ul> </ul> <ul><li>Internationalization of text</li> <ul> <li>Full Unicode range of codepoints</li> <li>New encodings: <code>utf-16</code>/<code>utf-32</code>/<code>ucs-2</code>(<code>le</code>|<code>be</code>), <code>CESU-8</code>, etc. </li> <li><code>encoding</code> options <code>-profile</code>, <code>-failindex</code> manage encoding of I/O </li> <li><code>msgcat</code> supports custom locale search list</li> <li><code>source</code> defaults to <code>-encoding utf-8</code></li> </ul> </ul> <ul><li>Zip filesystems and attached archives</li> <ul> <li>Packaging of the Tcl script library with the Tcl binary library, meaning that the <code>TCL_LIBRARY</code> environment variable is usually not required </li> <li>Packaging of an application into a virtual filesystem is now a supported core Tcl feature</li> </ul> </ul> <ul><li>Unix notifiers available using <code>epoll()</code> or <code>kqueue()</code></li> <ul> <li>This relieves limits on file descriptors imposed by legacy <code>select()</code> and fixes a performance bottleneck </li> </ul> </ul> <h4>Notable incompatibilities</h4> <ul> <li>Unqualified varnames resolved in current namespace, not global. Note that in almost all cases where this causes a change, the change is actually the removal of a latent bug</li> <li>No <code>--disable-threads</code> build option. Always thread-enabled</li> <li>I/O malencoding default response: raise error (<code>-profile strict</code>)</li> <li>Windows platform needs Windows 7 or Windows Server 2008 R2 or later</li> <li>Ended interpretation of <code>~</code> as home directory in pathnames (see <code>file home</code> and <code>file tildeexpand</code> for replacements when you need them)</li> <li>Removed the <code>identity</code> encoding (there were only ever very few valid use cases for this; almost all uses were systematically wrong)</li> <li>Removed the encoding alias <code>binary</code> to <code>iso8859-1</code></li> <li><code>$::tcl_precision</code> no longer controls string generation of doubles (if you need a particular precision, use <code>format</code>)</li> <li>Removed pre-Tcl 8 legacies: <code>case</code>, <code>puts</code> and <code>read</code> variant syntaxes</li> <li>Removed subcommands <code>trace variable</code>|<code>vdelete</code>|<code>vinfo</code></li> <li>Removed <code>-eofchar</code> option for write channels</li> <li>On Windows 10+ (Version 1903 or higher), system encoding is always utf-8</li> <li><code>%b</code>/<code>%d</code>/<code>%o</code>/<code>%x</code> format modifiers (without size modifier) for <code>format</code> and <code>scan</code> always truncate to 32-bits on all platforms</li> <li><code>%L</code> size modifier for <code>scan</code> no longer truncates to 64-bit</li> <li>Removed command <code>::tcl::unsupported::inject</code> (see <code>coroinject</code> and <code>coroprobe</code> for supported commands with significantly more comprehensible semantics)</li> </ul> <h4>Incompatibilities in C public interface</h4> <ul> <li>Extensions built against Tcl 8.6 and before will not work with Tcl 9.0; ABI compatibility was a non-goal for 9.0. In <em>most</em> cases, rebuilding against Tcl 9.0 should work except when a removed API function is used</li> <li>Many arguments expanded type from <code>int</code> to <code>Tcl_Size</code>, a signed integer type large enough to support 64-bit sized memory objects. The constant <code>TCL_AUTO_LENGTH</code> is a value of that type that indicates that the length should be obtained using an appropriate function (typically <code>strlen()</code> for <code>char *</code> values)</li> <li>Ended support for <code>Tcl_ChannelTypeVersion</code> less than 5</li> <li>Introduced versioning of the <code>Tcl_ObjType</code> struct</li> <li>Removed macros <code>CONST*</code>: Tcl 9 support means dropping Tcl 8.3 support. (Replaced with standard C <code>const</code> keyword going forward)</li> <li>Removed registration of several <code>Tcl_ObjType</code>s</li> <li>Removed API functions: <ul> <li><code>Tcl_Backslash()</code></li> <li><code>Tcl_*VA()</code></li> <li><code>Tcl_*MathFunc*()</code></li> <li><code>Tcl_MakeSafe()</code></li> <li><code>Tcl_(Save|Restore|Discard|Free)Result()</code></li> <li><code>Tcl_EvalTokens()</code></li> <li><code>Tcl_(Get|Set)DefaultEncodingDir()</code></li> <li><code>Tcl_UniCharN(case)cmp()</code></li> <li><code>Tcl_UniCharCaseMatch()</code></li> </ul></li> <li>Revised many internals; beware reliance on undocumented behaviors</li> </ul> <h4>New commands</h4> <ul> <li><code>array default</code> — Specify default values for arrays (note that this alters the behaviour of <code>append</code>, <code>incr</code>, <code>lappend</code>)</li> <li><code>array for</code> — Cheap iteration over an array鈥檚 contents</li> <li><code>chan isbinary</code> — Test if a channel is configured to work with binary data</li> <li><code>coroinject</code>, <code>coroprobe</code> — Interact with paused coroutines</li> <li><code>clock add weekdays</code> — Clock arithmetic with week days</li> <li><code>const</code>, <code>info const*</code> — Commands for defining constants (variables that can鈥檛 be modified)</li> <li><code>dict getwithdefault</code> — Define a fallback value to use when <code>dict get</code> would otherwise fail</li> <li><code>file home</code> — Get the user home directory</li> <li><code>file tempdir</code> — Create a temporary directory</li> <li><code>file tildeexpand</code> — Expand a file path containing a <code>~</code></li> <li><code>info commandtype</code> — Introspection for the kinds of commands</li> <li><code>ledit</code> — Equivalent to <code>lreplace</code> but on a list in a variable</li> <li><code>lpop</code> — Remove an item from a list in a variable</li> <li><code>lremove</code> — Remove a sublist from a list in a variable</li> <li><code>lseq</code> — Generate a list of numbers in a sequence</li> <li><code>package files</code> — Describe the contents of a package</li> <li><code>string insert</code> — Insert a string as a substring of another string</li> <li><code>string is dict</code> — Test whether a string is a dictionary</li> <li><code>tcl::process</code> — Commands for working with subprocesses</li> <li><code>*::build-info</code> — Obtain information about the build of Tcl</li> <li><code>readFile</code>, <code>writeFile</code>, <code>foreachLine</code> — Simple procedures for basic working with files</li> <li><code>tcl::idna::*</code> — Commands for working with encoded DNS names</li> </ul> <h4>New command options</h4> <ul> <li><code>chan configure ... -inputmode ...</code> — Support for raw terminal input and reading passwords</li> <li><code>clock scan ... -validate ...</code></li> <li><code>info loaded ... ?prefix?</code></li> <li><code>lsearch ... -stride ...</code> — Search a list by groups of items</li> <li><code>regsub ... -command ...</code> — Generate the replacement for a regular expression by calling a command</li> <li><code>socket ... -nodelay ... -keepalive ...</code></li> <li><code>vwait</code> controlled by several new options</li> <li><code>expr</code> string comparators <code>lt</code>, <code>gt</code>, <code>le</code>, <code>ge</code></li> <li><code>expr</code> supports comments inside expressions</li> </ul> <h4>Numbers</h4> <ul> <li><code>0<i>NNN</i></code> format is no longer octal interpretation. Use <code>0o<i>NNN</i></code></li> <li><code>0d<i>NNNN</i></code> format to compel decimal interpretation</li> <li><code>NN_NNN_NNN</code>, underscores in numbers for optional readability</li> <li>Functions: <code>isinf()</code>, <code>isnan()</code>, <code>isnormal()</code>, <code>issubnormal()</code>, <code>isunordered()</code></li> <li>Command: <code>fpclassify</code></li> <li>Function <code>int()</code> no longer truncates to word size</li> </ul> <h4>TclOO facilities</h4> <ul> <li>private variables and methods</li> <li>class variables and methods</li> <li>abstract and singleton classes</li> <li>configurable properties</li> <li><code>method -export</code>, <code>method -unexport</code></li> </ul> <h3 id="tkchanges">Summary of changes for Tk</h3> <h4>Many improvements to use of platform features and conventions</h4> <ul> <li>Built-in widgets and themes are scaling-aware</li> <li>Improved support of two-finger gestures, where available</li> <li>The <code>tk windowingsystem</code> “aqua” needs macOS 10.10 or later</li> </ul> <h4>New commands and options</h4> <ul> <li><code>tk sysnotify</code> — Access to the OS notifications system</li> <li><code>tk systray</code> — Access to the OS tray facility</li> <li><code>tk print</code> — Access to the OS printing facility</li> </ul> <h4>Widget options</h4> <ul> <li>New <code>ttk::progressbar</code> option: <strong>-text</strong></li> <li><code>$frame ... -backgroundimage $img -tile $bool</code></li> <li><code>$menu id</code>, <code>$menu add|insert ... ?$id? ...</code></li> <li><code>$image get ... -withalpha ...</code></li> <li>New <code>ttk::combobox</code> and <code>ttk::entry</code> options: <strong>-placeholder</strong> and <strong>-placeholderforeground</strong></li> <li>All indices now accept the forms <strong>end</strong>, <strong>end-int</strong>, <strong>int+|-int</strong></li> </ul> <h4>Improved widget appearance</h4> <ul> <li><code>ttk::notebook</code> with nondefault tab positions</li> </ul> <h4>Images</h4> <ul> <li>Partial SVG support</li> <li>Read/write access to photo image metadata</li> </ul> <br clear="all" /> <p align="center" class="footer"> <small><b> This is the main Tcl Developer Xchange site, www.tcl-lang.org . </b></small> <a href="/siteinfo.html">About this Site</a> | <a href="/cdn-cgi/l/email-protection#abdccec9c6cad8dfced9ebdfc8c786c7cac5cc85c4d9cc"><span class="__cf_email__" data-cfemail="a0d7c5c2cdc1d3d4c5d2e0d4c3cc8dccc1cec78ecfd2c7">[email protected]</span></a> <br> <a href="/">Home</a> | <a href="/about/">About Tcl/Tk</a> | <a href="/software/tcltk/">Software</a> | <a href="/community/coreteam/">Core Development</a> | <a href="/community/">Community</a> | <a href="/doc/">Documentation</a> </p> </td></tr></table><script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script></body></html>