2 ms·
> [...] and multiple return values make for a truly dynamic language If you are using a word "dynamic" as "once-good-but-now-increasingly-considered-worse-and-
by lifthrasiir 6y ago
> [...] and multiple return values make for a truly dynamic language
If you are using a word "dynamic" as "once-good-but-now-increasingly-considered-worse-and-worse", I agree. Lua is definitely too dynamic to be safely used.
Weeks ago I had to debug a Lua code looked like this:
commands = commands_template:gsub("<arguments>", arguments:gsub(" ", "\\ "))
If you can catch a problem, great! But most wouldn't be able to do so. And I used Lua for a prolonged time, to the extent that I have made a type checker which absolutely flags this case [1] and developed a very good list of intrinsic problems of Lua which obviously includes this one and still failed to notice the problem. Lua is a small language, but packed with lots of similar problems.
[1] https://github.com/devcat-studio/kailua/blob/323caab59c06230af7ee22835a681064de0ab165/kailua_check/src/check.rs#L2668-L2669 https://github.com/devcat-studio/kailua/blob/323caab59c06230...
- samatman 6y agoWhat is that even supposed to do? I tend to use lpeg for any complex string manipulation. gsub has bitten me once or twice by not thinking through whether something is a pattern nor not, sure.
- samatman 6y agoBut, no: I meant that after the fiftieth time I had to modify every call site of a Python function because I realized I needed to return a tuple rather than a scalar sometimes, I came to really appreciate multiple return values.
- lifthrasiir 6y agoIf that's the only real reason why do you keep using dynamic languages after all?
- lifthrasiir 6y ago> What is that even supposed to do? In some sort of deploy scripts, converting a command "template" into the actual command by replacing a fixed string "<arguments>" into the escaped arguments (I know, this is not sufficient but also not the exact code, I've simplified it for the easier inspection). Now guess what's the problem without looking at the manual. Also, don't say "use lpeg". Unless Lua supports a proper package system for every circumstance it's not a solution. Note that this deploy script runs in an embedded context, so no to luarocks and kins.