What other kinds of changes will a developer have to make when moving from Tcl 8.4 to 8.5?

See the document A Busy Developer's Guide to Tcl/Tk 8.5 [1 ] by Mark Roseman.

This topic also came up on comp.lang.tcl, initially in this thread [2 ].

Some of the responses posted include:

  • Read Changes in Tcl/Tk 8.5
  • Scripts that depend on the exact behavior of cursor motion in the text widget may have problems.
  • Scripts that depend on details of font handling may have problems.
  • you're SOL if you're on Mac Classic. :-) (Or windows 3.x, or I think Windows 95 and Windows 98, or CP/M, or OS/1 or [someone could insert their favorite antique operating system, but why bother?]
  • if you write scripts (or test suites!) that depend on formats of particular error messages coming from Tcl or Tk, you may have to change them. Various changes have been made to error messages.
  • If you use only tcl.h, tk.h and the exported functions from the stubs table you should be safe. (Ignore if you only code in Tcl, as opposed to Tcl+C.)
  • If you go from 8.4 to 8.5 it should be easy; simply recompile. (Ignore if you only code in Tcl, as opposed to Tcl+C.)
  • If you go from 8.x x <4 to 8.5 you may need to fix some reference to arguments which are not CONST (that changed in 8.4). (see Migration to 8.4: CONSTification ) (Ignore if you only code in Tcl, as opposed to Tcl+C.)
  • If you go from 7.x to 8.5 you can expect more work.
  • If you use tclInt.h or other nonpublic interfaces all bets are off...; try to recompile and see where the compiler bitches. (Ignore if you only code in Tcl, as opposed to Tcl+C.)
  • My very first test failed, trying xtem from http://www.ctan.org/tex-archive/support/xtem_texmenu/xtem/?action=/te ...
I get (when pressing the exit button)

bad variable name "geom(.xtemqd)": upvar won't create a scalar variable that
looks like an array element
     while executing
"global [set var]"
     (procedure "writeVarList2File" line 5)
:
(followed by more text that I won't quote)
:
  • Reply was: This statement used to be "useless": it would have created a variable that is completely unreachable from Tcl code. It is now an error.
  • If you were using the dict as an extension in 8.4, you may want to remove the package require dict since it is now built into 8.5.
  • There have been a number of significant upgrades for dicts in Tcl 8.5.
  • Integer operations no longer wrap around at 2^31 (or whatever value your platform dictates); make use of the int or wide functions, or bit masking, etc. to limit range explicitly if needed.
  • tcl_precision changed - where previously numbers might have displayed as 3.3, under 8.5 they may show as 3.30000000000003 for example. I had to fix this by adding additional trace commands and shadow variables to reformat the numbers. Concerns use with -textvariable and the like. Normally numbers presented to the user should have been explicitly formated anyway. Previously, the default was tcl_precision of 12, but with the expanded floating point functionality, that variable's value now is set to 0.
  • grid behavior changed when the widget is smaller than the container. Tcl 8.5 added the grid anchor command but the 8.5 default is nw while 8.4 behavior was center.
  • Take a look at the entries in the "changes" files (included in the Tcl and Tk source code distributions) that are marked ** POTENTIAL INCOMPATIBILITY **.
  • If you were using the Tile extension in tk 8.4, the functions were moved into the ttk namespace.
  • The autoconf for Tcl requires at least autoconf 2.57 to regenerate Tcl's configure.
  • read obsolete.tcl if you need to make use of ::tk::classic::restore to return to previous widget default widths, etc.
  • According to various reports, MacOS 9, IRIX 4, RISCos, Ultrix and ancient BSD systems are no longer supported by Tcl/Tk starting with 8.5.
  • First impressions with tcl/tk 8.5.0
  • ActiveTcl 8.5 on Unix is built with threads enabled - use of this tclsh starts a base thread, which will cause conflicts if other code within the process uses fork.
  • Text widget now defaults to a fixed-width font (TkFixedFont vs MS Sans Serif)
  • Xft support - With Tk 8.5, at configuration time, one has to choose either --enable-xft to get anti-aliased fonts or --disable-xft to get the old bitmap fonts. Under the X window system, at least, it is reported that you can only get one or the other. The result is that users may see a different set of fonts being displayed when using a Tk configured for the anti-aliased fonts, unless the machine in use has both bitmap and anti-alias fonts with the same font names. One developer reports that when his application ran under tk 8.5 with xft enabled, his canvas postscript output was no longer printing - because the fonts being selected from the canvas didn't match the fonts on his printer.

  • Code using a list where a string is expected may find that under 8.5, the value that is included now is braced:
$ tclsh8.4
% list #123456
#123456
%^D
$ tclsh8.5
% list #123456
{#123456}
%

While from a Tcl point of view, the two are equivalent, there are coding situations where a string is needed. As always, in Tcl, be certain to specifically use strings and string functions when strings are required, and use list functions and lists where lists are required.

DGP No, they are not equivalent. Tcl 8.4 is buggy. In Tcl 8.5, the bug has been fixed. See TIP 148 [3 ] for all the details.

PWQ 22 Aug 08, So now when I print out a list of four colour names using #rrggbb notation I can always expect the first colour to be braced and then rest unbraced, thanks for that, that is so much better. I am always wanting to eval comments as lists and I never want to use #rrggbb colour names in lists.

DKF: If you want to print as before, just join the list.


Other wiki pages related to Tcl 8.5 differences


LV 2008-08-21 I have had several developers who have been trying to bring up their Tcl 8.4 applications using Tcl 8.5. While the applications are coming up, the number one complaint that I get is that widgets are coming up with different colors. The primary example I have seen is the code sample I added over on iwidgets while trying to figure out a problem in one of the widgets. Besides the problem with the button placement, under Tcl 8.4, the code there comes up with the listbox having a grey background, but under Tk 8.5 it has a white background.

Is there something simple a developer can do to get this behavior reversed, other than changing lots of lines of code to hard code the color?

JH Use tk::classic::restore, although the new defaults are intended to be a strict improvement for modern UI conventions. This is not considered an incompatibility.

LV Is there something I can use so that the classic Tk radiobutton displays a diamond rather than a circle indicator? The Tk 8.5 man page for radiobutton mentions both, but I don't seem to see an option to get the diamond back. A poster on comp.lang.tcl suggested:

create two custom images that mimic the old 
look, and use those with the radiobuttons. 
That might be the quickest road to a solution. 

The reference in radiobutton.n to diamond was a red herring to me. Thanks to all.


LV When using a radiobutton or a checkbutton under X, and specifying -selectcolor, in Tk 8.5.0-5, the -selectcolor value is used regardless of whether the button is selected or not. This color was, previously, used only when the button was selected. Now, when the button is selected, a black dot or checkmark is overlayed on top of the select color.


LV A developer reports to me the following. In Tcl 8.4, he coded (incorrectly):

% proc retsortlist {} {
   set numlist [list 5 4 3 2 1]
   lsort -integer numlist
   return $numlist
}
% retsortlist
5 4 3 2 1

while in Tcl 8.5, he sees:

% proc retsortlist {} {
   set numlist [list 5 4 3 2 1]
   lsort -integer numlist
   return $numlist
}
% retsortlist
expected integer but got "numlist"

So a developer may find places in code being moved to Tcl 8.5 which now, correctly, indicates an error where before no error was seen.

MG It seems like 8.4 checked for a single-element list (which obviously doesn't require sorting) before it did validation of the list elements. In 8.4

  lsort -integer foo

returns foo, but

 lsort -integer [list foo bar]

throws the error you'd expect, expected integer but got "foo"


LV 2009 Jul 29 One of the clock scan behaviors changed between 8.4 and 8.5:

$ tclsh8.4
% clock format [clock scan "February 31, 2009"]
unable to convert date-time string "February 31, 2009"
% ^D
$ tclsh8.5
% clock format [clock scan "February 31, 2009"]
Tue Mar 03 00:00:00 EST 2009

If your application depended on clock scan to fail to parse certain types of dates, you will need to test that specific dependency, because it probably will not give you the result you were expected.


LV I still have been unable to build BLT against Tcl 8.5.x (where x = 0-7). Are there other, relatively well-known, Tcl packages which do not build against Tcl 8.5 yet?