6 ms·
> hugely because it is so easy to embed in other programs Not only; Lua is also an example of excellent language design: a minimum of concepts for a maximum of
by Rochus 3y ago
> hugely because it is so easy to embed in other programs
Not only; Lua is also an example of excellent language design: a minimum of concepts for a maximum of expressability; it's minimal, complete and elegant.
> Deno definitely has some good gestures toward a this
Lua is much leaner, only ~100k machine code. WAMR looks like a better candidate than Deno, but concerning performance and simplicity it has still to catch up.
- qznc 3y agoForth and Lisp/Scheme and TCL are in the same league. However, they are more alien to C programmers, I assume.
- Rochus 3y agoTCL, Forth and Lisp are languages with minimum possible syntax, delegating all higher-level concepts to runtime structures and conventions (e.g. which list position means what), whereas Lua for its syntax and semantics inherited, pruned and elegantly integrated the best features of Modula-2 and other languages. It is true that Lua is more familiar to C developers than the mentioned languages, since both Lua and C look back to the ALGOL ancestry; but Lua - unlike C - clearly follows the Pascal heritage.
- stefanos82 3y agoI've just used `cloc`-ed Lua repo's entire code base, excluding makefile's and markdown's: 33619 lines in total of C, Lua, and C / C++ Header code; very lightweight code base.
- Rochus 3y agoLua 5.1 has 11'081 SLOC in 32 .c and 1'506 SLOC in 23 .h files (without tests and examples).
- ufo 3y agoAnd that includes the test suite! Over 1/3 of that is inside the tests directory.
- brabel 3y agoThere's a single C file you can compile really easily with `gcc -o lua luaall.c`. It compiles the whole thing in a couple of seconds!
- stefanos82 3y agoYou meant to say `onelua.c` file; indeed it's a fascinating language, I have to admit.
- ufo 3y agoOne of the reasons why Lua is minimal is that it makes it easier to embed. It's no coincidence :) https://www.lua.org/doc/cacm2011.pdf https://www.lua.org/doc/cacm2011.pdf
- AlecSchueler 3y agoFascinating document, does anyone know if there's an html version?
- ufo 3y agoThere is, but the figures are broken :/ https://cacm.acm.org/magazines/2011/7/109909-passing-a-language-through-the-eye-of-a-needle/fulltext https://cacm.acm.org/magazines/2011/7/109909-passing-a-langu...
- pkphilip 3y agoSo also Groovy. I have embedded Groovy in web applications to use as a rule engine. It is also very easy to install. https://docs.groovy-lang.org/latest/html/documentation/guide-integrating.html https://docs.groovy-lang.org/latest/html/documentation/guide...
- brabel 3y agoI think a "competitor" to Lua would be Guile [1], but I am not sure if it gets close to Lua in terms of lightweightness... it was designed to be used in the GNU project, with similar objects as Lua: to be light, easily embeddable. It's a Scheme (Lisp) so maybe not for everyone's taste... its "coolest" use i know of is for configuring Guix [2] (the GNU version of Nix). [1] https://www.gnu.org/software/guile/ https://www.gnu.org/software/guile/ [2] https://guix.gnu.org https://guix.gnu.org
- JdeBP 3y agoThe competitors in practice were REXX and TCL. All three provide embeddable interpreters as libraries, and easy ways to extend what is available in scripts with custom domain-specific functions that one could call from them.
- geospeck 3y agomruby[1] fits that category too. It can be used with H2O[2] server as well. There was a discussion here a couple of months ago regarding some use cases[3]. [1]https://mruby.org https://mruby.org [2]https://h2o.examp1e.net/configure/mruby.html https://h2o.examp1e.net/configure/mruby.html [3]https://news.ycombinator.com/item?id=34937297 https://news.ycombinator.com/item?id=34937297