lua-users home
lua-l archive

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


On Sun, Sep 2, 2018 at 9:18 PM, Dirk Laurie wrote:
If you have variables x1 and xi, and by accident type xi when you mean x1


Yes, the typo "x1" -> "xi" is easy to make and hard to detect.
As Lorenzo already said, variables naming like "x1, x2, x3, ..., xi, xj" is a bad programming style.
In most use cases (under "good style"), the Levenshtein distance between existing identifiers is rather big.
(the Levenshtein distance is the minimal number of typos required to transform one string into another)
So, the probability of typos accidentally converting one existing identifier into another, is almost zero.