lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 2020-07-23 10:46 p.m., Andrew Starks wrote:
Lua is a scripting language, but it’s unique because it’s so tiny and simple. It has well documented undefined behavior where other languages give you guarantees about order and errors when it thinks you’re doing something stupid.

It’s fine. Just because you can do breathtakingly dumb things with it, doesn’t mean you can’t write correct code and be productive with it.

Well said.

You can keep waving your arms around but there isn’t any evidence of this being a real problem.

I believe there are tons of bad Lua code in the wild. And such state of things is not Lua-specific. The lower is language-entry threshold, the more inexperienced people will write dumb code.


The question is can language guard from errors that are relatively simple to guard? Should it? At what cost?

I don't consider that Lua table constructor syntax is clear. That you can separate items with "," or with ";". That long quote "[[" collide with indexing "[". That key-value pairs can be interleaved with value items.

But I consider language grows like tree, not created from scratch. When there was no metatables it was convenient to annotate array part with hash values "{3, 1, 4, 1, 5; name = "pi"}". (I don't have ideas why "[" was used as lead character for long quote.)

Thus such impurities will stay in language forever. Curse of "breaking changes"! Good thing is that you CAN write clear code in Lua. (Not like in PL/SQL and SQL.)

-- Martin