Hacker News new | ask | show | jobs
by AceJohnny2 2866 days ago
What Lua is doing today, TCL was doing 20 years ago.

Though I believe Lua is a smaller binary, which matters in some embedded scenarios. According to [1], the core Lua interpreter is 40kB with additional base libraries of 22kB, so total of 62kB.

There are a variety of "small TCL" implementations [2], and one of them, TinyTCL claims to be <60kB, excluding C library functions. I can say that for my embedded requirements, Lua would win...

[1] https://www.lua.org/notes/ltn002.html

[2] https://wiki.tcl.tk/1363

[3] http://tinytcl.sourceforge.net/

1 comments

Interesting. I tried Lua about 6 years ago and found myself unable to see an upside to the language in comparative perspective with python and tcl.

This is for full featured *nix systems programming in the HPC world so ymmv.

Lua's niche is absolutely as an embedded extension language for C/C++ programs. It's core benefits is how tiny and yet expressive it is (and it looks like C if you squint.) I've seen it show up in a variety of projects in that role, for games or embedded testing environments.

I indeed don't see it having any benefit over Python or TCL in more sophisticated environments.

The programming model for c ffi that lua uses is, I think, a little nicer.
I have a soft corner for Tcl. Tcl was a pioneer. Lua is smaller, faster and more tightly and coherently designed. Lua had coroutines right from the start. With Lua you have the option of using LuaJIT. I enjoy both, but I would be more wary of using Tcl in critical systems. But when its play time, i happily break out tclsh.
I've used TCL in production for 15 years. The only thing to really worry about is a consistent policy on language usage. Keeping to the base features of the language and extensions in tcllib/tclx is a pretty solid recipe.

That said here are things I advise.

* No upvar/uplevel. Use a namespace. * Use apply wisely. * No ad-hoc (say swig inline wrappers) extensions without deep review. * If you are writing a front end in tk - think twice. * If you are doing OOP with TCL choose wisely.