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

For me, the best feature of Tcl is actually not part of the language itself. It's a tool built on top of Tcl -- Expect.

Expect can be used to automate CLI tasks, but for me it is indispensable for testing programs with text-only UIs (I get to write a lot of those).

http://www.nist.gov/el/msid/expect.cfm




Ah, TCL, I knew thee well.

Back in the 8.3 days, when expect was still a commercial add-on form ActiveState for TCL on Windows, I implemented my own Expect command in TCL based on 'socket'.

If you ever find yourself using Expect with telnet, if you need more performance, you can implement your own Expect using socket which will run at least 10x faster.

The only trick is sending the right TELNET opcodes to get your target device to actually respond with a prompt!


there's a python replacement: http://pexpect.sourceforge.net/pexpect.html


You can also find Expect ports in other languages. For e.g.:

* Perl - https://metacpan.org/release/Expect

* Ruby - http://rubygems.org/gems/expectr




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

Search: