lua-users home
lua-l archive

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


On 2 October 2015 at 05:28, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2015-10-02 1:52 GMT+02:00 Egor Skriptunoff <egor.skriptunoff@gmail.com>:
>
>>   Every Lua beginner makes the same mistake: using local variables in
>>   interactive mode of Lua standalone interpreter.
>
> Those of us who post code snippets on Lua-L with officious "local"
> statements in it, making it unrunnable in the standalone, must bear
> at least part of the blame for that. Especially so if that code purports
> to answer a newbie's question.

And those who post code snippets on Lua-L _without_ "local" statements
in it must bear part of the blame for the proliferation of unnecessary
globals in a lot of Lua code out there.

I'm of the opinion that any presented code should be of the highest
possible quality, especially in this age of copy-and-paste
programming.

I would be appalled if somehow "don't use locals in examples because
it confuses REPL users" became a recommendation. To me that's an
anti-pattern.

-- Hisham