[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: upvals in Lua bytecode
- From: Geoff Leyland <geoff_leyland@...>
- Date: Thu, 2 Jun 2011 19:39:04 +1200
On 2/06/2011, at 7:27 PM, Reuben Thomas wrote:
> On 2 June 2011 08:19, Geoff Leyland <geoff_leyland@fastmail.fm> wrote:
>> On 2/06/2011, at 7:13 PM, Xingzhi Pan wrote:
>>
>>> Oh mine, it is a bit unintuitive to leave "global" as default.
>>
>> Local by default is worse: http://lua-users.org/wiki/LocalByDefault
>
> I've flip-flopped on this question, but have ended up in the "local by
> default" camp. It simply causes fewer problems (not "no problems")
> than the reverse, and simply laying some Lua side-by-side with
> equivalent Python shows this: the Lua contains many "local"s, whereas
> the Python contains almost no "outer"s.
Is "outer" new? I almost immediately got scope paranoia using Python, but that was a long time ago. I hardly ever get tripped up by global by default if I do its easily fixed. Can you work around local by default without outer?
In any case, if you want an edit, then "Local by default is also problematic"; if you're interested, I'd pick nothing by default; and, since the list's been here before, sorry for the noise, I was just to pointing to the wiki.
Cheers,
Geoff