lua-users home
lua-l archive

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


On Sun, Sep 2, 2018 at 10:15 PM, Roberto Ierusalimschy wrote:
A main issue here is what kind of errors people expect,
and that depends heavily from where those people come from.


Even Lua-only developer (without previous "toxic" experience with other programming languages) would stumble upon misspelled variables problem.
Detecting mistakes in variable names would help all of Lua users.

 
...if you write '<' instead of '>', or '<' instead '<=', or '+1' instead of nothing,...
In my view, they are all in the same category of typos in identifiers

 
Yes, Lua can't warn user about typos like "+1" -> "+11", "<" -> ">" and so on, because Lua is unable to determine whether they are mistakes or not.
But nevertheless detecting the most of the typos is achievable, because typos in identifiers are the most frequent typos and they usually are mistakes.
 
I'd suggest to perform an experiment to calculate (by Monte Carlo simulation) the probability Lua is unable to detect a random typo at compile time.
1) Take a big corpus of Lua scripts (Roberto, you've mentioned you have such one)
2) Emulate random typos: insert a symbol (Lua->Luna), delete a symbol (Lua->La), replace a symbol with one of its keyboard-neighbors (Lua->Lia), swap two adjacent symbols (Lua->Lau).
A typo which don't introduce changes in the bytecode should not be counted as a typo (for example, inserting an extra space in Lua program might be harmless).
3) Calculate the probability a typo in Lua 5.3 script would stay undetected ("detected" means "fails to compile").
4) Calculate the probability a typo in Lua script would stay undetected with "global-by-default" feature disabled.
5) Publish the results in this mailing list (how big would be the quotient of these two numbers?).