News for hackers. Stuff that matters.
Re:The return of the Tcl browser plugin by favadi on Tuesday October 06, 2015 @11:34AM (#10339560)
Any HN reader still uses Tcl in production system? Is it still relevant in 2015?
Re:The return of the Tcl browser plugin by bch on Tuesday October 06, 2015 @11:47AM (#10339661)
Here. Extremely enjoyable to code in and easy to integrate with C which makes integrating with arbitrary libraries and syscalls simple. The language rules are strict, but there are few of them, and they allow for surprising customizability (read: DSL). In a nutshell (for me), as competent as any language, and more enjoyable than most.

This describes explicit use, outside of cases where you may be using it directly or indirectly and not realize, like Expect, or in your network routers like your F5 iRules, etc.

My work is currently specifically Tcl-focused, at ActiveState, but see my other comments for years of enthusiastic Tcl experience from "general" development and operations gigs. I use it where I can, and I can use it in a lot of places.

Re:The return of the Tcl browser plugin by cartoonfoxes on Tuesday October 06, 2015 @12:08PM (#10339891)
> Here. Extremely enjoyable to code in and easy to integrate with C which makes integrating with arbitrary libraries and syscalls simple.

This is definitely a sweet-spot for TCL. It's not surprising that TCL doesn't get more attention when this use case has been so stable for so long.

Re:The return of the Tcl browser plugin by tptacek on Tuesday October 06, 2015 @01:02PM (#10340349)
Perhaps because Lua is a better language and, like Tcl, was custom-built for that sweet spot.
Re:The return of the Tcl browser plugin by mzs on Tuesday October 06, 2015 @01:19PM (#10340534)
I've not done any Lua but my oldest son has and he showed me. It really did not stand-out in my mind compared to say python. I guess it's pretty simple, embeddable, interoperable with C. It really was a great first language for him really but so would have js really.

Tcl is pretty neat though. It has this feel like lisp and very simple rules plus everything can be a string, which is prefect for gluing text output together between tools.

Re:The return of the Tcl browser plugin by tptacek on Tuesday October 06, 2015 @01:31PM (#10340677)
I've done a lot of Tcl work; two successive companies I worked at used it as their embedded language. It has its charms, but I would have a hard time working at another company that in 2015 chose Tcl over Lua.

Issues I have with Tcl:

* The syntax is as idiosyncratic as a Lisp, but has few of the advantages that Lisps get for homoiconicity.

* uplevel/upvar is a janky way to get metaprogramming. Compare metaprogramming in Tcl to that of Japanese Tcl errr Ruby.

* The Tcl runtime is outmoded.

I could probably think of others.

There's also the fact that Tcl's vaunted integration with C code has pretty much become par for the course in high level languages. I didn't find writing Ruby extensions to be any more painful than writing Tcl extensions. Modern high level languages also expose full-featured FFIs, so you often don't even need bindings.

Tcl was ahead of its time! It was a good embedded high level language before virtually every large project recognized the need for embedded languages. And the event-based model that Tk forced on it turned out to be pretty useful for network servers. It was a great choice in the late 1990s.

Re:The return of the Tcl browser plugin by mzs on Tuesday October 06, 2015 @02:29PM (#10341174)
Good points, I'd moved to python for embedding and shimming myself and then got bit cause SWIG had forced Cpython when there were other options later. I do still very much like the simple syntax though.
Re:The return of the Tcl browser plugin by tptacek on Tuesday October 06, 2015 @02:47PM (#10341346)
I like it sometimes more and sometimes less. For instance, the "everything's a string" parsing rules mean comments can cause parse errors.
Re:The return of the Tcl browser plugin by mzs on Tuesday October 06, 2015 @03:09PM (#10341514)
Ha, that's the very reason I used it at first!

  #!/bin/sh
  # the next line restarts using tcl \
  exec tcl "$0" "$@"
  ...
I just go so annoyed with is it /usr/bin/perl or /usr/local/bin/perl or ... And is it awk or nawk or ... And somebody told me this trick with Tcl and I was like, "I'll just use it for this simple script and be done with it."
Re:The return of the Tcl browser plugin by srean on Tuesday October 06, 2015 @02:24PM (#10341138)
That is exactly how I think of Lua. Lua stole Tcl's thunder and added its own. Perhaps the only thing missing is a community wide standard macro system that works with Luajit, without that Tcl can still do an one up on Lua with its uplevel.
Re:The return of the Tcl browser plugin by zokier on Tuesday October 06, 2015 @02:42PM (#10341313)
> Extremely enjoyable to code in and easy to integrate with C which makes integrating with arbitrary libraries and syscalls simple.

Can you really make arbitrary syscalls directly from Tcl? That sounds interesting to say the least

Re:The return of the Tcl browser plugin by pascalmemories on Tuesday October 06, 2015 @12:15PM (#10339944)
Totally, in business critical systems for all sorts of stuff.

Rewriting it would be enormous effort and provide no business benefit and be full or risk of introducing new (or re-introducing old) bugs in the process of converting to some whiz-bang c# or whatever is trendy.

We even built custom integration modules (DLLs in Visual C++ 6 for anyone curious). They integrate to legacy AS/400 systems and the interfaces used are totally legacy and unlikely to be easy to integrate with c++ 2015.

So, we're absolutely still using Tcl (and Tk) in 2015 and it is still relevant. It will be in use until the company (or the sun) implodes.

I do hate the syntax though. Yuk. [edit: I see others commenting that that's the thing they like ! I'm obviously an outlier or our code sucks more than most.]

Re:The return of the Tcl browser plugin by aurelian15 on Tuesday October 06, 2015 @01:55PM (#10340886)
As it stands, Tcl is still relevant in 2015. It is for example used as a scripting language in hardware design toolchains (such as ModelSim and Xilinx ISE).

Furthermore, the "standard" Git tools "gitk" and "git gui" are written in Tcl.

Re:The return of the Tcl browser plugin by srean on Tuesday October 06, 2015 @11:48AM (#10339681)
Given that it has had a better multithreading model compared to Cpython, JavaScript, has been and is a breeze to extend and embed, comes with lambda and coroutines too.. So why not. Very few other languages give a comparable sense of playfulness
Re:The return of the Tcl browser plugin by seiji on Tuesday October 06, 2015 @12:05PM (#10339869)
Very few other languages give a comparable sense of playfulness

There's an argument that modern software used in production environments shouldn't be imbued with a sense of playfulness just because it's fun.

If your choice is between tcl and Python, use Python. If your situation is "I can use waterer I want, tcl sounds fun," still use Python. Nobody wants to maintain sprawling tcl code today, much less in the future after projects get abandoned by their original creators.

Re:The return of the Tcl browser plugin by sea6ear on Tuesday October 06, 2015 @12:33PM (#10340102)
Tcl programs are still far easier to distribute (using Tclkit & Starkits / Starpacks) than for Python, which as far as I can tell requires either an installer or the end user to install a distribution of Python.

This one capability puts Tcl in a class that is fairly unique among scripting languages. It gets it into the class of easily distributable languages that usually only includes compiled native binaries like Go, C, C++, Haskell, Ocaml, etc

EDIT: Thinking further, perhaps Node compiled statically and Lua may offer similar capabilities to Tcl in terms of being reasonably distributable. Maybe PHP also if you distribute the static cgi binary.

I guess it's mostly Python, Ruby, Java, C# and Perl that require a distribution to be installed for programs to be easily run. This is mostly a problem for distributing one-off utilities for someone else to run rather than either major applications where an installer wouldn't be comparatively a lot of extra work, or situations where the computers are all under the programmers control.

Re:The return of the Tcl browser plugin by maxerickson on Tuesday October 06, 2015 @01:42PM (#10340767)
Perl and python both have wrapper style single exe packaging options. I guess they might not be easy on the dev side, but they are transparent to the end user.
Re:The return of the Tcl browser plugin by bch on Tuesday October 06, 2015 @12:18PM (#10339962)
> There's an argument that modern software used in production environments shouldn't be imbued with a sense of playfulness just because it's fun.

Your point is a good one (applicable to any language or technology), but in defense of the OP, bringing fun doesn't preclude usefulness or power. A painful development process doesn't mean "serious software". Additionally, if you don't want to put Tcl in production per se, it can still be part of the development process in a prototyping capacity. It's got great UI facilities (CLI, sockets, GUI), great introspection, and a healthy amount of whip-it-up-atude to get meaningful results quickly (and yes, enjoyably).

Re:The return of the Tcl browser plugin by srean on Tuesday October 06, 2015 @02:20PM (#10341096)
I actually agree with you wholeheartedly (digression: except maybe I will not go with Python as my goto language all the time, and I am pretty sure that's not the argument you wanted to make, but just for the record).

Not all code I write is even intended for production environments, that's where my previous comment was coming from.

Re:The return of the Tcl browser plugin by pmarin on Tuesday October 06, 2015 @12:28PM (#10340052)
Re:The return of the Tcl browser plugin by groovy2shoes on Tuesday October 06, 2015 @11:51AM (#10339701)
Yes. It's used a lot in the EDA world. It's really a neat little language with some cool metaprogramming facilities.
Re:The return of the Tcl browser plugin by sebcat on Tuesday October 06, 2015 @11:50AM (#10339695)
Yes. An ncurses-based appliance configuration UI and a seccomp-sandboxed DSL environment.

libtcl is really easy to sandbox with seccomp, I recommend it over [interp create -safe]. Run the interpreter in a seccomp-enabled child and have the parent do all privileged operations. Set resource limits on the child. Have them communicate over a socketpair. Have the parent spawn sandboxed children whenever the rlimits run out. For what we're using it for, it works really nice.

Re:The return of the Tcl browser plugin by davidw on Tuesday October 06, 2015 @11:53AM (#10339745)
It's used for the test suites of SQLite and Redis.
Re:The return of the Tcl browser plugin by bch on Tuesday October 06, 2015 @11:59AM (#10339819)
And gcc (via dejagnu) and others. Testing is a good point to bring up; Tcl is pretty nice to use.

See http://wiki.tcl.tk/1502 for descriptions, reactions, and links.

Re:The return of the Tcl browser plugin by michaelsbradley on Tuesday October 06, 2015 @01:59PM (#10340925)
Re: testing, see also the Caius Project:

Caius – A functional testing framework in object-oriented Tcl

http://caiusproject.com/

https://github.com/tobijk/caius

Re:The return of the Tcl browser plugin by srean on Tuesday October 06, 2015 @02:29PM (#10341183)
I find its use in Redis really curious because Antirez is also the author of Jim a leaner, more functional Tcl.
Re:The return of the Tcl browser plugin by gaius on Tuesday October 06, 2015 @02:06PM (#10340993)
Lots of places the "full stack" developer will never see. CAD and simulation software, routers, electronics, 3d graphics, industrial control. The web is still only a small corner of the software world.
Re:The return of the Tcl browser plugin by kryptiskt on Tuesday October 06, 2015 @11:56AM (#10339780)
OpenOCD is built on it, so it's very relevant for embedded development.
Re:The return of the Tcl browser plugin by shanemhansen on Tuesday October 06, 2015 @01:12PM (#10340460)
TCL is still relevant. I don't think browser plugins are still relevant. TCL + emscripten seems like a great fit here.
Re:The return of the Tcl browser plugin by eleh on Tuesday October 06, 2015 @03:03PM (#10341465)
Depends. Lets say you have a service that is running on your local PC at some port >1024. It uses a special binary TCP protocol and controls hardware from which images are coming in live stream. You want to display these images in a browser window, on the way there you want to resize them. And then you want to use them in the web application where the window is embedded. You have a stable tested Tcl library to do this in normal client environments, but now the requirement is a web application. How would you get Javascript and emscripten to do this task?

I think there are two points, where a browser plugin is still relevant: (1) connect with hardware or resources where a browser has no access, from a web page. That is when you can write a little companion Tclet to do exactly this little task. (2) Deployment of an existing Tcl application to thousands of users. That's so much easier when you just need to drop the .tcl file on a web server, and your users get the update as soon as they press F5 in their browser to reload the page.

Re:The return of the Tcl browser plugin by dmux on Tuesday October 06, 2015 @05:53PM (#10342678)
Not exactly "production" software, but we've started using Tcl as a cleaner alternative to Bash.
Re:The return of the Tcl browser plugin by sea6ear on Tuesday October 06, 2015 @07:09PM (#10343071)
I've actually used it a lot as a sort of "sane" scripting engine that I could include with other software to deal with various configuration tasks that would be too painful in DOS batch or (somewhat less painfully) bash.

So it has gotten used a lot around the edges of other software that I've written in C# or as part of config steps in InnoSetup.

It's a great tool for random little messy bits that need to be done where you don't want to deal with installing something larger.

Re:The return of the Tcl browser plugin by HarryHirsch on Tuesday October 06, 2015 @11:37AM (#10339589)
Yes. Yes. NAMD.
Re:The return of the Tcl browser plugin by dalke on Tuesday October 06, 2015 @11:58AM (#10339801)
Blame me (partially) for that. ;)
Re:The return of the Tcl browser plugin by acveilleux on Tuesday October 06, 2015 @12:49PM (#10340230)
It's the main scripting language in the Cloverleaf interface engine. One of the bigger player in the healthcare systems integration arena (along with Mirth, Corepoint and a few more.)
Re:The return of the Tcl browser plugin by mzs on Tuesday October 06, 2015 @12:02PM (#10339838)
Yes I use it to script telneting into many dinky devices and changing/viewing config all in one fell swoop with expect. I also have some simple tcl/tk scripts to automate some tasks. But most often I do vxWorks dev from the commandline instead of tornado/workbench with the use of tcl scripts that use the WRS provided tcl scripts.