News for hackers. Stuff that matters.
Re:Lua and Python (2020) by klodolph on Friday January 15, 2021 @02:46PM (#25795382)
Absolutely right.

The Lua implementation was definitely its strong point, and LuaJIT is reportedly extremely good as well. I say “was” because the circumstances have changed and there are much better alternatives around.

Circa 2000 or so, if you wanted to stick a simple, self-contained language in your app for extensions and scripting, Lua was one of the very few reasonable choices. There are a ton of reasons why you might not want to stick TCL, Guile, or Python inside your application.

So Lua was used not only in the WoW UI but in a bunch of other apps from that era, and gained a lot of social traction that way. Among other things, if you were making a game, Lua let your level designers and UX people write a little bit of code without having to get their hands dirty with C++ (which nobody wants). The language is very off-putting otherwise.

Re:Lua and Python (2020) by makapuf on Friday January 15, 2021 @05:12PM (#25797233)
> there are much better alternatives around. Coule you give some examples ?
Re:Lua and Python (2020) by klodolph on Friday January 15, 2021 @06:56PM (#25798291)
This is gonna be subjective, because it depends on what your priorities are.

The two alternatives at the top of my list are Gravity and Wren. They are both designed for the same general profile that Lua has—a scripting language, safe to use, embeddable, with a small VM (low code size).

- https://github.com/marcobambini/gravity

- https://wren.io/

The language design choices are nice and familiar to people who are used to other existing languages. Lua is a bit radical.

Two other options are AngelScript and Squirrel, which are both a bit older and more mature than Gravity and Wren.

- http://www.angelcode.com/angelscript/

- http://squirrel-lang.org/

Finally, it’s much more feasible these days to embed something like Mono, and Guile has gotten a lot better.

Re:Lua and Python (2020) by bch on Friday January 15, 2021 @10:03PM (#25799617)
> Lua was one of the very few reasonable choices. There are a ton of reasons why you might not want to stick TCL, Guile, or Python inside your application.

That sounds quite editorial - can you list some of the “ton of reasons”? C. 2000 Tcl was already 12 years old, received a major performance upgrade w 8.4[0], and was liberally licensed.

[0] https://www.linux.com/news/tcltk-840-release-announcement/

Re:Lua and Python (2020) by klodolph on Saturday January 16, 2021 @04:28PM (#25805670)
It seems like people have forgotten how bad TCL is, as a language. Everything is a string, except variables, which can be arrays of strings. You want a number? String. You want an object? String. You want a data structure? String.

TCL is a bad choice for almost anything. It is only marginally more usable than using a shell. It seems like the only reason you would use TCL is so you could throw together a GUI in front of a command-line program, or maybe stick a very bare-bones scripting interface inside something else.

Re:Lua and Python (2020) by nrclark on Saturday January 23, 2021 @12:27AM (#25879928)
I wrote a lot of TCL code in 2015-2017, and it was better than I thought going into it. TCL has first-class lists and maps, and they're not string-based under the hood at all. It's true that TCL was "all string all the time" in the early days, but now it's more like Python - you represent those types as a string, but that's not the internal storage.

I think TCL gets a really bad rap. Once you get past the unusual syntax, it's pretty nice to work in. Almost Python level nice. It supports classes, exceptions, first-class functions, and has some concepts I've never seen in other languages (such as upvar). It's easy to embed, or easy to use standalone. Installation is small and portable. And it feels like if Lisp and Bash had a baby together, conceived with love.

TCL in 2005 might have been a beast. TCL in 2020 is way better than you might expect. And it persists also, with a stable ecosystem as an embedded language in various CAD/EDA tools.

Re:Lua and Python (2020) by detaro on Saturday January 16, 2021 @04:33PM (#25805704)
"luckily", someone created cmake so younger generations get to experience this problem too...
Re:Lua and Python (2020) by klodolph on Saturday January 16, 2021 @04:34PM (#25805715)
CMake is definitely worse than TCL, having used both.