4 ms·
I left Python for Lua years ago, haven't looked back. Even if you don't care about tail-call optimization, etc., LuaJIT (http://shootout.alioth.debian.org/u32/b
by silentbicycle 16y ago
I left Python for Lua years ago, haven't looked back. Even if you don't care about tail-call optimization, etc., LuaJIT (http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=luajit&lang2=pypy http://shootout.alioth.debian.org/u32/benchmark.php?test=all...) is pretty compelling. (Also, OCaml, though I use Lua more day-to-day.)
- codexon 16y agoLuaJIT has a memory limit of 4gb. When it is compiled for x64, it has a limit of 1gb. You cannot use Lua lanes to bypass this, the Lua states must be in different processes. http://lua-users.org/lists/lua-l/2010-11/msg00241.html http://lua-users.org/lists/lua-l/2010-11/msg00241.html The lack of try/catch is also a nuisance.
- silentbicycle 16y agoLua has try/catch-like functionality, it's just called pcall ("protected call"), or xpcall (http://www.lua.org/manual/5.1/manual.html#pdf-xpcall http://www.lua.org/manual/5.1/manual.html#pdf-xpcall) if you want to run a callback before the stack unwinds. Running debug.debug inside xpcall's handler will drop into a shell on error, which is particularly handy. error("error tag") is comparable to raising an exception. I wasn't aware of LuaJIT's 1gb limit, but it's neither hard nor unusual to run several Lua states in multiple worker processes.
- rlander 16y agoI love lua (almost as much as I enjoy python and erlang), but how do you cope with the lack of libraries? Since last year I've been trying to use lua on personal projects, but I find the generally poor documentation and lack of libraries very annnoying (and unproductive).
- silentbicycle 16y agoI haven't found libraries lacking, but we probably work on different things, and I don't have any problem with writing quick wrappers for existing C libraries. There's a fair bit of Lua libs that are insufficiently documented or tested, or have bit-rot (esp. due to changes in Lua itself), but the situation is getting better. For libs, I usually check http://lua-users.org/wiki/LibrariesAndBindings http://lua-users.org/wiki/LibrariesAndBindings and http://luarocks.org/repositories/rocks/ http://luarocks.org/repositories/rocks/ . I've written a couple libraries, as well. See e.g. lunatest (http://github.com/silentbicycle/lunatest http://github.com/silentbicycle/lunatest, an xUnit-like + randomized (QuickCheck-ish) testing library) and Tamale (http://github.com/silentbicycle/tamale http://github.com/silentbicycle/tamale, Erlang-style pattern-matching for Lua).
- rlander 16y agoYou're right, I haven't touched C in a decade =) Good work on Tamale (and great README btw). The more I program in Erlang, the more if/else nests feel unnatural in imperative languages.