lua-users home
lua-l archive

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

2017-03-03 23:11 GMT+02:00 Peter Melnichenko <>:

> Yes, it would be more convenient if this idiom was recognized. But there
> should still be a warning if the global variable is definitely incorrect, e.g.
> `local load = loadstringgg or load`. So that means that Luacheck would
> need a new class of defined globals that can only be accessed through
> this idiom. It already distinguishes read-only and settable globals
> so it shouldn't be difficult to implement this.
> Some minor problems: strange things like
> `local load = loadstring or table.unpack` will be allowed, while
> variations of the idiom like
> `local unpack = unpack ~= nil and unpack or table.unpack` won't.

What is the main reason for using Luacheck?

(a) A debugging tool.
(b) Enforcing a certain style of coding.
(c) Advising a programmer on things in his program that
might make trouble one day.

Unless you use it for (b), I would not be concerned about the
occasional extra warning in situations where any human can
see it is OK. Turing has already taught us that we can't use
a program to test correctness of a program. Why clutter
Luacheck with exceptional cases?