[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: All your local are belong to us
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: Sat, 03 Oct 2015 12:54:53 +0200
On 02/10/2015 18:17, Hisham wrote:
On 2 October 2015 at 05:28, Dirk Laurie <email@example.com> wrote:
2015-10-02 1:52 GMT+02:00 Egor Skriptunoff <firstname.lastname@example.org>:
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
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
You really stole the words out of my mouth (as we say in Italy :-).
I fully agree!
I never use the REPL for that. If I want to try a snippet I fire up my
beloved editor (SciTE) and run the snippet from there as a throwaway
script (it is almost as quick a procedure and syntax highlighting also
helps to understand the thing better).
The very few times I use the REPL are when I have to try out a quick and
dirty expression (i.e. as an advanced calculator) or to verify the
result of some operation (i.e. the new bit-fiddling operators in Lua 5.3).