Slashdot Mirror


Review:Tcl/Tk in a Nutshell

Despite his long turnaround time, I still have not yet killed CowboyNeal for his long-delayed review of Jeff Tranter and Paul Raines' Tcl/Tk in a Nutshell. Part of the well known O'Reilly Nutshell series, this is a great book for those getting seriously into Tcl/Tk, or those who need a desktop reference. Click below for more information. Tcl/Tk in a Nutshell author Paul Raines & Jeff Tranter pages ? publisher O'Reilly and Associates rating 7/10 reviewer CowboyNeal ISBN summary Not for beginners, this book makes a wonderful desktop reference.
Rating: 7/10 What's Good? Being another book in the "nutshell" series, it's no surprise that this book contains all the commonly used commands in Tcl/Tk. Designed to sit on your desktop and help you look up those commands you forgot, this book is a weclome aid to any forgetful Tcl/Tk programmer. Each description has just enough to help one remember the command, without going too in-depth. Each section is devoted to the most oft-used Tcl/Tk tools, such as Expect and [incr Tcl]. The chapters covering the C interfaces use the same style as Java in a Nutshell's class reference, simply listing the function name, it's arguments, and the argument types. While not the best instructional aid, if you already know the function, it's just enough to remind you of how to use it. I really liked the compactness and simplicity of this in previous "nutshell" books, and I like it here as well. When covering some of the extentions of Tcl/Tk (Tix, for example), longer, more in-depth explanatations of each option and/or argument are given, as many people may not have used Tix before. Chapter 15, "Hints and Tips for the Tcl Programmer," is particularly useful, as it contains many "gotchas," the "Tcl way" of doing things, and things that might confuse beginning Tcl/Tk programmers (such as Tcl's parsing), and even a few things that Tcl/Tk gurus may want to brush up on. What's Bad? What I like about some "nutshell" books is that they often provide enough background for one to learn the language that is the subject of the book and begin programming in it. An example of this "Java in a Nutshell", one of my favorites. This book, however, assumes the reader is already a competent Tcl/Tk programmer, and makes no attempts to give an introduction to Tcl or Tk. I read this book in the hopes of picking up Tcl/Tk, but unfortunately it was not written to teach. When I do learn Tcl/Tk, however, I'll have a valuable resource handy to assist me in my coding. Some of the Tcl/Tk tools covered may not be used by everyone (such as Tclodbc), which may make some people as if some parts of the book will go unused. I found that if one uses only the core Tcl/Tk commands, then the majority of the book won't even aid you, as it is aimed at Tcl/Tk extensions. What else is bad? In all seriousness, I couldn't even nitpick further. For a desktop Tcl/Tk reference, this one is tough to beat. I even found myself liking the index. Who should buy this book? If you already know Tcl/Tk, then this book will be a great aid, especially of you use extensions, such as Oratcl or [incr Tcl], then this book will be a great help in remembering the commmands you don't use often, but need to get a quick synopsis of. If you're looking to learn Tcl/Tk, I wouldn't recommend this book, as it doesn't got into a great amount of detail. It would probably help one who hasn't written Tcl/Tk in a while, and is feeling a little rusty get back up to speed quickly.

You can pick it up at Amazon.

Table of Contents

Preface

  1. Introduction
  2. Tcl Core Commands
  3. Tk Core Commands
  4. The Tcl C Interface
  5. The Tk C Interface
  6. Expect
  7. [incr Tcl]
  8. [incr Tk]
  9. Tix
  10. TclX
  11. BLT
  12. Oratcl
  13. Sybtcl
  14. Tclodbc
  15. Hints and Tips for the Tcl Programmer

Appendix - Tcl Resources

Index

44 comments

  1. Very good book, even for *some* beginners by Pulsar · · Score: 1

    I have very little experience with TCL, however by relying on this book, my programming knowledge in other languages and just by browsing through some TCL scripts I got my hands on, I was able to teach myself a working knowledge of TCL. True, not everyone can learn like this, but for those who can, this is the perfect book to learn TCL.

    1. Re:Very good book, even for *some* beginners by PieceMaker · · Score: 1

      afdaffdas

  2. Damn Trolls...Re:Tcl is dead by Pulsar · · Score: 1

    Actually, TCL is not dead. I use it almost every day to script irc clients and bots.

  3. Too early to say this by arivanov · · Score: 1

    You forget that there are still people giving first aid to the dead corpse. For example it is still the language for commercial programming. Refer to http://sunscript.sun.com for example.

    --
    Baker's Law: Misery no longer loves company. Nowadays it insists on it
    http://www.sigsegv.cx/
    1. Re:Too early to say this by Anonymous Coward · · Score: 1

      Actually, the correct URL(s) for Tcl related stuff are http://www.scriptics.com and http://www.tclconsortium.org. As for this "Tcl is dead" crap, I hate to break it to you but Tcl is used by a lot of "real" programmers. Tcl has a nice feature that Perl lacks. You will be able to understand what your Tcl code is doing a month or a year after you wrote it.

    2. Re:Too early to say this by jonathansamuel · · Score: 1
      As Little Richard once said of rock and roll:

      Tcl/Tk is dead but it won't lie down!

      --

      Marjo Wycam, Master of the Programming Arts
  4. Re:Tcl is dead by warmi · · Score: 1

    Story Server uses tcl as their scripting language.

  5. Tcl is alive and well by Anonymous Coward · · Score: 0

    Tcl is alive and well in the Informix database application development world.

  6. Re:Tcl is dead by mtngrown · · Score: 1

    Hrmmm.....

    Frankly makes me want to go out and buy this
    book, just to keep an alternative to perl alive.

  7. Re:Tcl is dead by JordanH · · Score: 1
    Expect Tcl to survive.

  8. Non-experienced reviewer. by Ih8sG8s · · Score: 1

    I found the review as well thought out as it could be under the circumstances. My suggestion is that slashhdot should have book reviews done by people who have experience with the language.

    As someone who is a very experienced Tcl/Tk programmer, I cannot trust a Tcl/Tk book review done by someone who admittedly has little or no experience with the language. Although the reviewer mentions that the book is not for the beginner, he lacks the understanding of the language to adequately comment on the ability of the book to address advanced issues.

    Please understand that this is not an attack. As I said, I found the review gave a good overview of what is covered, all things concidered.

    1. Re:Non-experienced reviewer. by Anonymous Coward · · Score: 0

      Ok, I will jump in here. I am a Tcl expert
      and I have this book on my desk at work. It
      is really handy when you are sitting there
      thinking "what is the name of that option I
      pass to the listbox widget to get it to stop
      it from setting the X selection".

      Mo DeJong
      dejong at cs.umn.edu

    2. Re:Non-experienced reviewer. by Ih8sG8s · · Score: 1

      Ok, good enough. Until now, the best reference book is Practical Programming in Tcl/Tk. But that book is huge, and picking through to find the gems can be a pain.

      What revision does it cover?

    3. Re:Non-experienced reviewer. by mwillis · · Score: 1

      As an intermediate Tcl/Tk programmer with this book, I would tend to agree with parts of the original review. The core of Tcl/Tk is 136 pages. The rest of the 438 page book details stuff I really didn't use, but might want to someday. For example, I liked the 19 pages on expect, the 76 pages on tix, and 74 pages on using BLT.

      Another point: CowboyNeal wrote
      ...makes no attempts to give an introduction to Tcl or Tk.
      Well, to be fair this isn't what a Nutshell book is for. However, chapter 15 is exactly what he was looking for.

      A rundown on what I, a non-reviewer, liked.

      Tcl/Tk core language : 136 pages
      - Essential. This is what I bought it for. I can never remember if it's -bg or -fill, so I really like this section.
      The C interface : 37 pages
      - I doubt I will ever use this. But hey, it's nice to have.
      Expect : 19 pages
      - I have used this already. Expect rocks.
      [Incr Tcl] : 11 pages
      - I will never use this.
      Tix : 96 pages
      - I like this section, but wish there were pictures to go with the examples. This is a minor gripe.
      TclX : 33 pages
      - I will never use this.
      BLT : 74 pages
      - I like this section. I got stuck trying to install BLT one time, and gave up on it. Now I will give it another try.
      Oratcl : 8 pages
      Subtcl : 7 pages
      Tclodbc : 8 pages
      - I am not a database guy.
      "Hints and Tips for the Tcl Programmer" : 16 pages
      - Great section. Much of the material came from comp.lang.tcl FAQ's, but it is still great to have. Should it be up front?

      There is also a pocket ref for Tcl/Tk, at 90 pages, which is written by Paul Raines, one of the authors of the nutshell book.

      Final advice: it is usually cheaper to buy these books online. I bought this book online for $16.50, as opposed to the $24.95 list price.

    4. Re:Non-experienced reviewer. by Col.+Klink+(retired) · · Score: 1
      what is the name of that option I pass to the listbox widget to get it to stop it from setting the X selection

      man listbox

      Seriously. I am a Tcl expert and have used many of the extensions, um, extensively. The man pages are all well written and concise. I use tkman to read them and tkman also lets me highlight important sections for future reference.

      --

      -- Don't Tase me, bro!

  9. Wrong series of books... by argentus · · Score: 1

    The author of the review went in with incorrect thoughts about the series of books... The "Nutshell" series is (and always has been) the eqivalent of a man page for commands within the given system.

    Simply stated, it's a (very large and detailed) command reference card, not a howto.

    1. Re:Wrong series of books... by DanaL · · Score: 1

      The Nutshell series may be intended as merely a command reference, but a lot of us use them as tutorials as well and there are a number of good reasons for this:

      1) They're generally cheap. As a starving student, I was much more willing to spend $19.95 on Java in a Nutshell than one of the more expensive titles.

      2) Long term value. Once you get through the tutorial book, it's often not useful as a reference, you want shorter & more succint info instead of pages and pages of detail. If the book can be a reference AND teach you the language, you get more value for your dollar.

      3) Previous titles in the Nutshell series have been useful as learning aids. I picked up most of my Java knowledge from the Scribble example in Java in a Nutshell.

      The reviewer was simply anticipating how many of us would try to use the book and advising us accordingly.

      -dl



    2. Re:Wrong series of books... by argentus · · Score: 1

      It's beyond me how you know that the author was anticipating what others would do when he wrote the article, since he never said that. Neat trick, though. *grin*

      However, if he had that purpose in mind, that is fine. It's still noteworthy that, though some books may be useful for learning from the "ground up", that is not their primary intention. I would never recommend that a newbie go out and purchase a "Nutshell" book to learn from, unless they had other sources. Of course, with the number of tutorials on the web these days, one can usually pick up the basics of a given topic and then grab a "Nutshell" book and augment their skills.

  10. Re:Tcl is dead by mwillis · · Score: 1

    I don't know. I really like PERL. I also really like Tcl/Tk, mainly because of Tk. But I don't like PERL/Tk. So for me at least, Tcl still lives.

  11. You should not use TCL by Anonymous Coward · · Score: 0

    TCL is a sorry excuse for an extention language. Use guile scheme instead. Stallman posted his thoughts on this a long time ago.

    1. Re:You should not use TCL by Anonymous Coward · · Score: 0

      Not everyone in the world gives a flying &^%$ what Stallman thinks.

    2. Re:You should not use TCL by Nabuchodonosor · · Score: 1

      I bet you have not even tried Tcl as axtention language ever. "If RMS says I shouldnt use Tcl, then I wont use Tcl". bah.

      --
      ---> Did you know Linux stands for Linux Is Not UniX ?
    3. Re:You should not use TCL by Anonymous Coward · · Score: 0

      yet another person who didn't bother to find out the facts.

    4. Re:You should not use TCL by holderlin · · Score: 1

      Guile Scheme is a great language, however Tcl is the simplest way to extend an aplication, because all of us are familiarized with the imperative languages, and all you may want to do you can do it with Tcl

  12. what _is_ a good tcl/tk book for starters? by tabooVI · · Score: 1

    i understand the purpose of the nutshell books is not to teach, but to be a reference. in that light, could someone reccomend a good book for starting to pick up tcl/tk?

    1. Re:what _is_ a good tcl/tk book for starters? by Ih8sG8s · · Score: 1

      I have read several books on the subject, and the best "howto' book for Tcl/Tk is Practical Programming in Tcl/Tk. It covers tcl/tk 8.0x, and is quite good for beginners and pros alike.

    2. Re:what _is_ a good tcl/tk book for starters? by Anonymous Coward · · Score: 0

      I'm biased as I'm the author of Graphical Applications with Tcl and Tk, a book that provides a tutorial in the language. See http://www.tclconsortium.org/books/index.vet for a list of Tcl/Tk books, or http://www.pconline.com/~erc/tcl.htm for more on my book. -Eric Foster-Johnson

    3. Re:what _is_ a good tcl/tk book for starters? by Ih8sG8s · · Score: 1

      I have read your book.

      It is also good starting point for people wanting to learn Tcl/tk, especially Tk.

      A good piece of work.

    4. Re:what _is_ a good tcl/tk book for starters? by Telcontar · · Score: 1

      Not having read the other replies (possibly repeating someone's suggestion), here is my favorite: Practical Programming in Tcl/Tk, by B. Welch. Covers 8.0 fully, and introduces you step by step into tcl and then tcl/tk. However, it does not cover Tix and other extensions.

    5. Re:what _is_ a good tcl/tk book for starters? by ibbey · · Score: 1

      Prior to buying this book, I wasn't -really- impressed with any of the Tcl books I've read. Graphical Applications is a good intro, but is fairly slow moving-- I'd prefer a bunch of quick chapters to the few very long (often >50 pages) ones.

      Practical programming is an excellent reference, but it's not written as a tutorial. If you prefer to learn from a tutorial, you'll probably be better off with something different. That said, anyone who's serious about Tcl should probably have it for more advanced topics.

      While the Nutshell Book may not be a good -only- book for absolute beginners, it's definitely a great second book. My only complaint with it is a one of formatting-- on commands with subcommands (such as 'string length'), the subcommand should be bolded, or otherwise made to stand out a bit better. Otherwise, It's a great book, Personally, I'd give it 9 out of 10.

  13. Re:You should use TCL by Anonymous Coward · · Score: 0

    Ha. Scheme as an extension language. I had to
    learn scheme in my CS courses and it was a big
    pain. Why would anyone want to use scheme in
    real life when Tcl makes everything so much
    easier? RMS is a bright guy but he is flat out
    wrong when it comes to Tcl.

  14. Amen to that by tobyp · · Score: 1

    Couldn't have put it better myself?

    Toby

  15. Re:Tcl is dead by drivers · · Score: 1

    Perl serves an almost completely different purpose than Tcl. Perl makes a lot of things easier than any other language, if you are trying to do those things. What Tcl is great in, is embedding in a C program. You can add your own commands to the language which are actually handled by your C functions, and make a scripting language for you C program, either internally, or letting the users (or other developers) easily add their own scripts. disclaimer: some things are possible in some languages but easier in another language. Use what works. Knowledge is power.
    -- a Perl and Tcl programmer

  16. tcl is NOT dead by josepha48 · · Score: 1

    there are some posts here that say that TCL is dead.. I think not. THere are several companies that use tcl internally, SCO is one of them, as well as AOL, and I have heard that Cisco also uses TCL. Perl/Tk is also very much alive, as TK offeres a very nice and easy way of doing a GUI for Perl. Being someone who has used Tcl/Tk I have found that it is a quick way to bring a GUI alive, and also extremly good for prototyping an application. Once one masters Tcl/TK it can be a very powerful scripting language. Although I have not msatered it yet.

    --

    Only 'flamers' flame!

    1. Re:tcl is NOT dead by Anonymous Coward · · Score: 0

      I work for Intel, and on many of our projects we use a mix of both Perl and TCL. TCL is much easier to use when integrating with c++ applications because of its interface. So for that reason we use it a lot.

    2. Re:tcl is NOT dead by Stephen+Williams · · Score: 2
      THere are several companies that use tcl internally, SCO is one of them, as well as AOL, and I have heard that Cisco also uses TCL.

      Add Nortel Networks to that list. I work for them; coding in Tcl/Tk is a major part of my job.

      (Standard disclaimer: I do not speak officially for Nortel Networks)

  17. Amazon more expensive than at least one location: by mwillis · · Score: 1

    Amazon isn't the cheapest.

    http://www.addall.com;

    results:
    A1BOOKS: $16.25 + $3.95 s/h = $20.20
    BOOKPOOL: $16.50 + $3.80 s/h = $20.30
    FATBRAIN: $19.95 + $4.95 s/h = $24.90
    AMAZON: $19.96 + $7.95 s/h = $27.91

  18. I Just Bought the Book Yesterday by jonathansamuel · · Score: 1
    There are other good Tcl books, but most of them were too old, dating from 1996 or before.


    The book Tcl/Tk In a Nutshell is cryptic for beginners like me. For instance, the group listing of commands starting on page 11 contains three columns. The first seems to be a package type of some kind (file, info,array...) The second is the command, and the third explains what the command does.


    But the book never explains what the first column is, and at that point in the book (page 11!) it is by no means obvious to a beginner.


    Even so I am glad I got it. I wanted something reliable and up to date, and I have usually had good luck with O'Reilly books in the past. Plus, my wife enjoys it when I read her the descriptions of the animals on the cover. This one features an ibis.


    --

    Marjo Wycam, Master of the Programming Arts
  19. Re:Tcl is dead by Anonymous Coward · · Score: 0

    What scripting language you use may depend on the application and on your background. Different horses for different courses. TCL has the advantage of only needing one data type - strings. :~) Perl lets you exercise your fingers with its cartoon-obscenity syntax. I like Python, for everything. It is OO, and it is very esay for another programmer to read - it has been described as executable pseudocode. http://www.python.org

  20. Re:Amazon more expensive than at least one locatio by Syslevel · · Score: 1

    Amazon is almost NEVER the cheapest. Tell us something new.

    Amazon is just the spammest. Links in the face everywhere.

  21. Experienced reviewer. by SEGV · · Score: 1

    That's a valid comment; no disrespect to the review, reviewer, or commenter.

    Just to point out that I do a number of reviews on C++ and programming in general, and am quite a competent C++ programmer.

    My GIMP review should be posted shortly, and I'll admit I'm not a GIMP god but I do use it for graphics needs (whenever I have such needs).

    I'll probably review another UML book shortly, if anyone's up for that.

    --

    --
    Marc A. Lepage
    Software Developer
  22. Scheme is cool. by Anonymous Coward · · Score: 0

    So you probably knew C (or something similar) before you took the classes. Scheme is no pain unless you're spoiled by the braindead(IMNSHO) infix syntax of imperative languages. As a language it has more good properties than any assembler derivative (read anything in the C family) will ever have. If you didn't realize the good things in Scheme when you studied, then you didn't learn it properly. You were motivated to learn it well, weren't you ? (and not hacking with C, when you were supposed be doing scheme.) My guess is that you just didn't study it on principle, because you felt the the language you're using right now is the best one there is.

    After using C++ for several years I changed to Common Lisp and it's heaven compared to C++, I was stupid not to change sooner.

    AC

    ps. Try to stay open-minded...

  23. Re:Tcl is dead by jonathansamuel · · Score: 1
    What Tcl is great in, is embedding in a C program.


    Do your comments apply to C++ programs as well?
    --

    Marjo Wycam, Master of the Programming Arts
  24. Why isn't Tcl dead yet? by Jarvo · · Score: 1

    I've found Tcl to be such an *ecch* method of creating an interface. I can't wait until SOME government brings out a law agaisnt it.