[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Luacheck 0.19.0
- From: Peter Aronoff <telemachus@...>
- Date: Fri, 3 Mar 2017 14:10:44 -0500
Peter Melnichenko <email@example.com> wrote:
> The best solution is to allow non-portable globals for that line only:
> local unpack = unpack or table.unpack -- luacheck: compat
> -- Peter
Thanks for this. I’ll look more into the options to tell luacheck what to
do for specific lines in this way.
That said, I now wonder about something more general. When people write in
Lua `local x = y or z`, that’s often an idiom for cases where y is likely
to be nil. Or, at least, where y can be nil, but the program should
continue without trouble by assigning z to x instead of y. In my mind, it
isn’t clear whether this *should* trigger a warning, since presumably the
programmer puts that “or z” in there to address the danger of y being nil.
We have not been faced with the need to satisfy someone else's
requirements, and for this freedom we are grateful.
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System