BOOK The Tcl Programming Language

The Tcl Programming Language is a comprehensive guide to Tcl, covering Tcl 8.6.

See the official book page for more information and a detailed Table of Contents.

The ebook version (PDF format) is available from Gumroad .

The print version is available from Amazon in USA/Canada and their European sites including UK , Germany , France , Spain and Italy . If you like the book, positive reviews on Amazon are appreciated.

Support

Please send any errors or other comments about the book to apnmbx-wits at yahoo.

Errata

Page 19, middle of page, (from Gregor E.)

    C:\temp>ftype TclApp=C:\Tcl\bin\tclsh.exe

should be

    C:\temp>ftype TclApp=C:\Tcl\bin\tclsh.exe "%1" %*

Page 61, bottom of page, (from Alex P.)

values proscribed by EIAS should be values prescribed by EIAS

Page 76, top of page, (from Alex P.). The word the is repeated. ... unless the the -nocase option is specified. should be ... unless the -nocase option is specified.

Page 83, Table 4.7 5th row, (from Alex P.)

This includes 1, false, no ... should be ... includes 0, false ...

Page 97, bottom of page, (from Saurabh G.). In the code example,

    regexp {(?ic)RE} STRING

should be

    regexp {(?in)RE} STRING

Page 162, bottom of page, (from Gregor E.). The syntax description of dict for should be

    dict for {KEYVAR VALUEVAR} DICTIONARY SCRIPT

Page 297, bottom of page, (from Alex P.). The condition if {$i >= 4} ... should be if {$i >= 3}....

Page 298, top of page, (from Alex P.). if {$i == 2}... should be if {$i == 1}....

Page 298, middle of page, (from Alex P.). return code value 1 / return should be return code value 2 / return.

Page 300, top of page, (from Alex P.). ...discussed is 2 or error...' should be ...discussed is 1 or error...''.

Page 308, top of page, (from Alex P.). close $chan should be close $result.

Page 312, middle of page, (from Alex P.). -errorstack ERRORSTACK? should be ?-errorstack ERRORSTACK?.

Page 320, bottom of page, (from Alex P.). namespace syntax ?NAMESPACE? should be namespace children ?NAMESPACE?

Page 355, in script towards bottom of page, (from Alex P.), variable geom_term_geom should be geom_term.

Page 355, bottom of page, (from Alex P.), either seq_arith or seq_geom should be either seq::arith_term or seq::geom_term.

Page 362, in the script at the top of the page, platform::identity should be platform::identify.

Page 362, in the script at the top of the page, package ifneeded binpkg... should be package ifneeded $package_name....

Page 365, middle of page, (from Alex P.). The experience gained from these system ... should be The experience gained from these systems ...

Page 378, last line of page, (from Alex P.). The line This facility is available to all savings accounts but only to selected checking accounts. should be This facility is available to all checking accounts but only to selected savings accounts.

Page 393, top of page, (from Alex P.). ... the command self class command returns ... should be the self class command ....

Page 416, top of page, (from Alex P.). The << redirection works... should be The >> redirection works....

Page 601, top of page, (from Alex P.). The syntax block for foreach,

    1) ''allrows'' should be instead of ''foreach'' (in RESULTSET, STATEMENT, DBCONN lines) 
    2) STATEMENT line should be ended as ''... ?--? VAR ?DICT? SCRIPT''
    3) DBCONN line should be ended as ''... ?--? VAR SQL ?DICT? SCRIPT''

Page 451, 1st, 2nd and 3rd procs might be more bureaucratic according to the previous namespace eval ::bureaucrat ..., i.e.

    proc ::bureacrat ...

might be

    proc ::bureaucrat ...

Page 450, middle of page, the sentence While a TclOO based implementation ... looks somewhat incomplete. Perhaps it might be: In contrast to a TclOO based implementation ... or While a TclOO based implementation ... provides an implicit per-channel context, a namespace based one does not maintain ...

Discussion


JJM - 2017-07-25 - Got the book in the mail, looks really great. Nice job.

arjen - 2017-07-06 19:35:22

Congratulations! It is a welcome addition to the Tcl library and a voluminous one at that :)


bll 2017-7-6 Looks very comprehensive. Looking forward to reading it.

ALX 2017-07-09 17:45 Year! First! :-) "Well, thanks for your prompt purchase! You are the very first buyer of my book! /Ashok"

RLH: Will there be a book/ebook bundle? APN No bundle because of the different distribution channels. But you might be able to make use of the discounted price as noted above. RLH Got them both. Reading through the book now. :)

MHo This book is simply overwhelming!


JOB - 2017-11-14 22:15:55

Congratulations as well! I quickly went through the TOC which looks really promising. Good to see that all those extensions and functionality recently added to the core like coroutines, TclOO, threads, database connectivity, etc. are all covered by the book. APN Thanks, and that was indeed one of the primary motivations behind writing the book.


SYStems did anyone buy the ebook via gumroad, I googled gumroad and the reviews are really bad.

APN When you say reviews, I presume you mean Gumroad and not the book :-) I'm surprised you saw so many negative reviews of gumroad because I chose it based on the positive reviews I'd seen. (Also because they take care of EU VAT without my having to individually file.) I think most negative reviews of gumroad are from the seller's perspective (which would be me), not the buyer's. Personally, I have had no issues with selling through them. About a hundred e-book copies have downloaded so far and have not heard of any complaints from buyers.

SYStems yes 100% I meant gumroad, not the book :)

DPG This book is great! I got the physical version because I'm just physical like that ;) This book has a good Index, which is important to physical book people. APN Thanks, appreciated. However, such comments on the book's Amazon page would be appreciated even more, hint, hint :-) DPG Done! APN Great! Thank you.

SYStems Can you please make available an epub version of the ebook. APN Unfortunately not. I did try producing both epub and mobi formats originally but did not find the results acceptable the way tables and figures were displayed. It just leaves a bad impression about the book.


aplsimple - 2018-09-20 04:35:56

Dear Ashok,

I've found some tiny issues in your book. Below they are listed, an original text is quoted, a comment begins with "-".

APN Thanks for the list Alex. I have integrated most of your corrections into the Errata above. The remaining are below with my comments.

4. There are no outputs of some commands:

Page 373: - should be:

  % oo::class create CheckingAccount {
  ...
    ==> ::SavingsAccount

Page 388: - should be:

  % oo::class create ClassWithOneArg {
  ...
    ==> ::ClassWithOneArg
  % oo::class create ClassWithNoArgs {
  ...
    ==> ::ClassWithNoArgs
  (there are other cases of this)

APN This is by design. Commands that are typed at the interactive prompt, and scripts as they might be stored in a file. The former is shown with a % prompt and the output of every command is printed for pedagogic purposes. For the latter, no % prompt is shown and only the output of the last command is shown. Intermediate output is not shown as it only adds to the clutter and is of limited interest. I've mentioned this difference in Section 1.3.1 (Conventions) but of course it's probably not fair of me to expect readers to have read that :-)

5. Page 379 (bottom):

There is no definition of BillPay class and it is not good because the example would not work in CLI. You might modify it as:

  % oo::class create BillPay {}  ;# Empty class for demo only
    ==> ::BillPay
  % oo::define CheckingAccount {mixin BillPay EFT}
  % info class mixin CheckingAccount
    ==> ::BillPay ::EFT

I mention in the text, "if you had a BillPay class defined", but your way is probably better.

6. The problem is that you omit the % tclsh's prompt in many examples throughout the book.

It's no problem when there is no output of command or the output is shown in the same line.

However, if there is the "==>" output then the corresponding input should be marked (and really very often marked!) with "%".

Otherwise a reader may be perplexed with what command ouputs this. It's also a question of consistency.

See e.g. sections 14.4.3, 14.6, 14.7, 14.9.1, 14.10, 14.11.3.3.

APN See my explanation above for interactive vs. script distinction.

Regards, Alex Plotnikov

APN Thanks again!


aplsimple - 2018-09-20 12:48:56

Let me repost myself from https://groups.google.com/forum/#!forum/comp.lang.tcl

I'd got here in Voronezh obl., Russia, your book (printed in USA, Middletown, DE, 25 July 2018) in a month after request. Continuously fascinated by the book, esp. while resolving a question from time to time.

It takes some comments. The book was got from Amazon indirectly, i.e. at first it had been sent to Europe and only after that to Russia. There was no direct Amazon delivery to Russia maybe because of those sanctions, you know:) The delivery had taken ONE MONTH, money about 2500 roubles (~ $40).

The book is amazing. Bible of Tcl indeed and Ashok P. Nadkarni being Tcl apostle. Do not pay much attention to its typos and tiny drawbacks. They are nothing compared with its goods. Moreover, methinks, Ashok would be grateful all of you guys for pointing at the drawbacks whatever they are:)

Hopefully this info would help someone.


aplsimple - 2018-09-23 14:48:07

Here

https://aplsimple.github.io/en/tcl/booksum

is the utility for executing the code samples of "The Tcl Programming Language" book. You can view also a text ch14_tcloo.txt containing the output of utility.

All you need to use the utility is

 1) insert the code samples into its "bundle" variable, with your comments and debugging stops
 2) run the utility from console or your editor (e.g. from Geany IDE with Run command: tclsh "./%f").

The utility's special feature is that you need not delete "%" prompts of the book's samples after copy-pasting them. You can also add comments, your own code, debugs and save all into separate chNN*.tcl files which makes the utility rather useful while reading the book's chapters.

See details in samples/OOtcl_book.tcl that contains the samples of draft chapter 14 "Object Oriented Programming" available here:

http://www.magicsplat.com/articles/oo.html

The samples are numerated according to the draft which is not the same as the book. You can clone the utility for other chapters of the book.

It would be nice to include other samples into booksum.rar , however there is much sense in purchasing the book and personal playing with its gigantic store of samples.

This utility allows to have a convenient summary of read chapter after those code plays. The reading of your own summaries is often the best mode to refresh your knowledge.


aplsimple - 2018-09-24 16:36:08

Updated (described above)

https://aplsimple.github.io/en/tcl/booksum

would allow to paste a Tcl sample that hasn't the proper indentation. The corresponding updates were borrowed from

https://wiki.tcl-lang.org/15731

The correction of code indentation is important when you copy-paste from a pdf file rather than a html page. The pdf viewers (at least those I've tested) remove the indentation at copying a code snippet. Some of viewers could even distort the resulting code because of %, →, Ø, page titles etc.

Adobe pdf reader (in Windows) and Okular document viewer (in Linux) both allow to copy the code snippets of "The Tcl Programming Language" without distortions.