Hacker News new | past | comments | ask | show | jobs | submit login

One of the biggest advantages of TCL in my opinion is the simplicity of its syntax. The lexer is quite simple, straightforward and easy to create. Properly written TCL interpreters are quite small and memory efficient. Because of this TCL used to be quite a popular choice as an embedded scripting language for various appliances (eg. Cisco used TCL for their VoIP/IVR scripts).

Nowadays Lua has mostly taken TCL's place as an embedded scripting language of choice and I must say I'm a little sorry, there are some things that I miss from TCL.




Actually, I think its syntax isn't just simple, it's simplistic. It's simple to implement, but it presents some rather unexpected behaviour to the user. To wit:

  proc hello {} {
    # I'd like to put an unmatched { in my comment
    puts "Hello!"
  }
This doesn't compile because of the unmatched {.

But this does, by adding another unmatched } - in the following string:

  proc hello {} {
    # I'd like to put an unmatched { in my comment
    puts "Hello!}"
  }

In other news, Richard P. Gabriel can stop arguing with himself about whether worse is better. In this case, worse is pretty silly!


This is one of the reasons I'm only a little sorry that Lua has taken over. Not without its shortcomings, Lua is a big advancement in this regard! :)


I will be borrowing this: "its syntax isn't just simple, it's simplistic"

I've lost hours to the syntax errors in comments before. Coupled with TCL's bad error messages it's maddening.

   #syntax errors in comments are dumb
   
   proc test {a b} {
   } # test


   % source tmp.tcl
   wrong # args: should be "proc name args body"
How long does it take to find that one in a 1000 line file? It doesn't even give a file name or line number.


You might try Nagelfar, an extensible syntax checker: http://nagelfar.berlios.de/

Nagelfar can easily find these types of errors, plus you should be able to define syntax for your own commands (as in your previous comment.)

tclsh nagelfar.tcl engtech.tcl Checking file engtech.tcl Line 1: E Wrong number of arguments (5) to "proc" Argument 4 at line 2 Argument 5 at line 2

Comments are warty in Tcl, you would be better off to understand Tcl's syntax conventions, rather than assuming comments work like other languages. See item #10 at: http://wiki.tcl.tk/10259


Why didn't you just escape the brace with "\"?


That's not the point.

The question is not "How can I put an unmatched curly bracket in my comment?"

The question is "Why are the semantics of the language - including, but not limited to brace matching - so peculiar and unexpected?"

Look at my second code example! The matching brace is in a string, in another command, on the next tine! And it works! And removing either one breaks the code!


Why would you escape something in a comment??


TCL is still used extensively in the EDA (Electronic Design Automation, i.e. hardware design) industry.

As someone who works in the EDA industry, I can't say that our adoption of a given technology is exactly an endorsement!


Compared to peculiarities of user interface and general buggyness of most EDA packages I've seen all gotchas in Tcl's syntax are pretty insignificant.


Yes, Cisco IOS had TCL embedded in a few places. You could run scripts from the command line and access SNMP MIBs, run scripts on certain conditions, and I'm sure there's more.

F5 load balancers also use TCL for their iRules. With such a simple language you can do almost anything, such as rewriting the request, split test, fend of DDOS attacks.

TCL has quite a history with the network community. The "expect" language is built on top of TCL and was a popular way of automating CLI tasks on routers/switches before better tools came around.


Oh man, my only experience with TCL was a short-lived attempt at using it to do some stuff on a Cisco AS5400 (TDM/VoIP gateway) in 2005. It was terrible.

I found out that with certain bugs in the TCL script, the device would hard crash (dump to console and restart). On top of that, Cisco's documentation was flat-out wrong sometimes, with incorrect names for functions. Even getting it to timeout a phone call after n seconds wasn't workable; at best you'd get 10-15 seconds resolution.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: