BOOK Tcl and the Tk Toolkit (2nd Edition)

Amazon reference; [L1 ]
Authors: John Ousterhout (1st edition material), Ken Jones (2nd edition material)
Paperback: 816 pages 
Publisher: Addison-Wesley Professional; 2 edition (August 10, 2009) 
Language: English 
ISBN-10: 0-321-33633-X
ISBN-13: 978-0-321-33633-0
Copyright: 2010
Book web site: 

See also: for a table of contents, sample chapter, and description. and reviews, etc. at

See [L2 ] for a search of more than a dozen online bookstores for this book.

Discussion brought from BOOK Tcl and the Tk Toolkit page

There is work afoot in early 2005 to update this book with a second edition. Jeff Hobbs announced at the Thirteenth Annual Tcl/Tk Conference that this book is on the way and will include up-to-date knowledge on Tcl/Tk 8.5. The rewrite is done by Ken Jones.

KJ To be fair, I'm lead author and chief cat wrangler on the project. Donal Fellows, Brian Griffin, Eric Foster-Johnson, and David Welton are also contributing significant portions of the new edition. John Ousterhout is not participating on the second edition, but it has his blessing. There are large chunks of his first edition text incorporated in the book, and I tried to maintain his overall style for the second edition.

On the other hand, the development editor insisted that I convert all of John's tables of commands into bulleted lists. I refuse to shoulder the blame for that change.

And after far too many delays (most of them my fault), it has finally hit the shelves.

DWW is showing the second edition to be released July 2007.

(LV That release date changed over the past two years. However, it appears as if the book may in fact be available now in 2009.)

SYStems and here is the link [L3 ], but I find it very weird, as far as I know John Ousterhout is no longer involved with Tcl, at least he is not contributing any code. So on what basis will he make a new version of this book, and why around the end of 2007, is it so to include Tile and OO? Finally I believe if John Ousterhout got re-engaged working on Tcl it might help a lot in Tcl marketing. He is high profile!

LV 2007 August 10 Well, today I searched and the previously mentioned link is now dead, and no second edition of the book appears on that site. So, I next went to (which apparently is really just a redirect to ). They show 3 books when searching for Tcl. Practical Programming, Effective Tcl/Tk Programming, and the PostgreSQL Developer's handbook.

No new editions of any of these are listed. Their "other things you might like" sidebar lists a java book, a web tech book, and a networking book. All of which are several years old.

Well here is the link again [L4 ]. There are a number of sites now showing this, including Amazon UK and so on. The ISBN number is ISBN-10: 032133633X, ISBN-13: 978-0321336330. Still nothing on the AW Professional website.

Ok, so here it is, totally official! A second edition updated to cover Tcl 8.5 and indeed co-written by the creator of Tcl! [L5 ]
RLH: I would think him too far out of the Tcl realm (time wise) to be the actual co-author.
DKF: The primary author/technical editor of the second edition is Ken Jones.
LV: Unless Mr. Jones has started from scratch, the fact that Dr. O wrote the original material upon which Mr. Jones has built certainly qualifies Dr. O to be listed as a co-author.
RLH: Yes maybe I phrased that wrong. I took the original with the intent that JO actively contributed to this version and that it wasn't just his original material. But yes, he would be co-author.
DKF: The base material is JO's, but a lot has been added.
SYStems: The link is dead now! Is the book being cancelled, anyway, a new book should wait for version 8.6 to include the OO stuff
DKF: I've got no control at all over the links... but when it comes to the book, it should be remembered that the time to produce the book is rather longer than the time to produce 8.6, as work started on it while 8.6 was still firmly in alpha. Please cut the authors at least some slack!
RLH: pffft, are you kidding me?! I will be buying this book.
DKF: Correction, preparatory work on this book started when 8.5 was in alpha. (Getting the contracts for the team of people who did the second edition was a big job, and nobody was working on it full-time anyway.)
KJ: I was soooo tempted to add at least an appendix on some of the new 8.6 features. But we were already so late bringing this book to print that my publisher would have shown up on my doorstep and strangled me -- and my editor would have helped dispose of the body -- if I had tried to do it.

RLH: O'Reilly just updated my safari subscription with the released version. w00t!

Will there be signings at the Portland Tcl/Tk conference in the fall?

KJ Well, I plan to be there. And I'll be bringing copies of the book to sell, in case you haven't already contributed your $1.25 (or whatever slice I get) by buying a copy.

AMG: I just ordered a copy! I'm so excited... :^)

AMG: Is there an online errata listing?

RLH: Send errata to the webmaster of the book site (address above). An errata page is coming.

LV I've been unsuccessful in finding one so far. The pearson web site (owners of Addison-Wesley) only have a table of contents displayed on the student page for ordering the book.

AMG: Maybe we should start one here on the Wiki, then relocate it later if a more appropriate home is discovered or becomes available.

LV If you would like to start a section, that would be fine. Hopefully there is a mechanism for reporting these items to the author, because otherwise the information won't be easy for them to track. I know I visited the official book site, mentioned above, and found a few links that didn't seem to be working the day I stopped in. I'm going to try some other time when I have more time to play with it.

RLH: Go to the book website listed at the top of this page and email the webmaster. That is the way to do it at the moment. The "webmaster" is Ken and he will gladly take your errata and he told me a page for just such a thing will be up soon.

AMG: I sent an email on the 18th of October 2009 but have not yet received a response.

Fabricio Rocha - 13 Mar 2010 - Three months after ordering it at, I finally received it. Great book, greatly complements the man pages. But there are some evident bugs in some code listings. I don't want to offend anybody, but this discussion about an errata which is never created -- here or in the official site -- surprised me (badly) a lot. If you don't mind, I'll take the liberty to create the section.


10.6.1 - Basic Ensembles

Fabricio Rocha - 13 Mar 2010 - The example code defines proc plus (line 2), which is never used; the usage refers to an example add subcommand, so the procedure's name should be add.

10.6.4 - Handling Unknown Ensemble Commands

The original code listing is this:

rename string strCore
proc strReverse {string} {
        set result {}
        for {set i [strCore length $string]} {$i>0} {} {
                incr i -1
                append result [strCore index $i]
        return $result

proc unknownStrCmd {string subcommand args} {
        puts "Passing $subcommand through to strCore"
        return [list strCore $subcommand {*}$args]

namespace ensemble create -command string -map {
        reverse {strReverse}
} -unknown unknownStrCmd

Fabricio Rocha 13-Mar-2010 - It does not work. After being sourced in tclsh8.5, the script generates a number of wrong # args: should be "strCore index string charIndex" messages after the "Passing match through strCore" (which, unexpectedly, appears after ANY command is typed in tclsh). AFAIK, {expand} was officialy substituted by {*} in Tcl 8.5, but even after replacing it I could not get the example to work. Actually, I tried to execute the example because I found it strange that, according to the text, the "passing $subcommand ..." messages would appear even when strCore was called directly, without being called via the string ensemble.

Lars H: It should work after removing the {expand}$args. The -unknown handler is only supposed to return the target command prefix (like one would specify in the -map dictionary), not the entire command.

Fabricio Rocha - 14 Mar 2010 - The solution is more obvious than I could think of: the call to strCore at proc strReverse (line 5) is missing the string argument from which the index will refer to (the line should be append result [strCore index $string $i]). Lars, I got different results when using {*}$args and when removing it completely. Without it, the unknown procedure seems to be called three times for a string reverse abc command. When using it, I get only one message Passing match through to strCore and the string is also correctly reversed. Both behaviours are different than these pointed by the book. (Anyway, could someone explain why the Passing match through to strCore appears even when I type just exit in tclsh??)

RLH You should contact Kent...but if the errata comes should be on a different page.

Fabricio Rocha - 14 Mar 2010 - I almost created another page, Robert, but I thought that keeping all the discussion about the book in one single page would be better (I must admit I am not aware of any rules regarding pages about books in the wiki, and I think it is something to debate...)

RLH I don't really think there are rules per se. Just thought a potentially long errata page would be better served on its own page is all.

See also:

BibTeX Citation

  author =       {John K. Ousterhout and Ken Jones and Eric
                  Foster-Johnson and Donal Fellows and Brian Griffin
                  and David Welton},
  title =        {Tcl and the {Tk Toolkit}},
  publisher =    {Addison-Wesley},
  year =         2010,
  key =          {tcl2010},
  series =       {{Addision-Wesley Professional Computing Series}},
  address =      {Upper Saddle River, New Jersey},
  edition =      2,
  isbn =         {{978-0-321-33633-0}}