Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

LuaJIT

Name: LuaJIT 2012-02-25 0:48

LuaJIT

Name: Anonymous 2012-02-25 21:21

Here we are!
- Lua Tables are mutable and encourage modification, instead of creation, meaning there is no easy way to do functional programming with Lua.
- `t={[{1,2,3}]="abc"}; print(t[{1,2,3}])` wont print "abc", meaning that `{1,2,3} != {1,2,3}`. In general, Lua's logic seems odd: "nil+1" results in error, while "(not nil)+1" eval to 2.
- Lua uses floating point values instead of integers and 1234567890123456789 would result into 1.234567890123457e+18
- Lua is unstable: API changes frequently, functions are being added and deleted continuously, `table.foreach` being a good example of to be deleted function, and then there is `table.unpack`, which present only in some versions of Lua.
- Lua is inconsistent: `t = {"a","b","c"}; print(t[2])` works, but `print({"a","b","c"}[2])` fails.
- Hash-Table as a primary data structure has some issues. There is no simple and safe way to implement FIRST and REST function from Lisp: either you have to copy whole Table or modify it, and sequential access is somewhat slow. There is no easy way to remove an element from a list. Even worse, the size of a list may not be what you expect: "b={};b[666]="a";print(#b)" will print 1. Lua Tables also don't provide advantages of catenable double-ended queues -- a silver bullet data strucure, you'll find in modern Lisps and Haskell.
- Lua's REPL wont pretty-print tables, instead it'll print something like "table: 0x807e978"
- Hashtables hold much of Lua's data, and even simple variable access goes through table system, producing several L2 cache misses in process just to get to value. That makes Lua slower than comparable alternatives, like Lisp.
- Table indexing starts from 1, instead of 0, like everything in computing. That acts as a source of errors and confusion, when interfacing with external APIs or converting algorithm from Lua to C/C++, while 0 still acts as a dangling pointer.
- Lua's GC is a naive mark-and-sweep implementation, which stores the mark bit directly inside objects, a GC cycle will thus result in all objects being written to, making their memory pages `dirty` and Lua's speed proportional to the number of allocated objects. Lua simply was not designed to support hundred thousand objects allocation per second.
- Quirky syntax with underscores for special variables and cryptic symbols for simple functions, like `#xs` for `length(xs)` and `x = start,end,step` instead of range(start,end,step), while logical connectives (`and`, `or` in place of `&&`, `||`) are hard to notice between other symbols. do/then/end everywhere could be annoying.
- Lua was built as a glue language, and it shows. Much of Lua hype comes from it's usage as a simple integrated scripting language in video games industry. That makes typical Lua user a teenage gamer with little expectations or taste for computation features and productivity.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List