[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: One more item to the collection of Lua hate-speech
- From: Geoff Leyland <geoff_leyland@...>
- Date: Thu, 8 Jul 2010 18:24:31 +1200
On 8/07/2010, at 6:04 PM, Vaughan McAlley wrote:
> On 8 July 2010 12:44, RJ Russell <russellsprouts2@gmail.com> wrote:
>> add one new keyword, global, and keep the local keyword.
>> Everything is local by default, not overriding any already existing locals, but the global keyword makes a global, and the local keyword creates a new one.
>>
>> a=1 --auto local
>> do
>> a=2 --same one
>> end
>>
>> (Though 5.3work3 with _ENV changes a lot.)
>>
>
> I think using the local keyword makes it easier to spot a variable‘s
> scope when scanning code. It would be less obvious whether a variable
> is a local or an upvalue (or a global declared elsewhere).
>
> Vaughan
But there's nothing stopping you using "local" if you want to is there?
An alternative might be that every variable you assign to has to have an in-scope non-implicit local or global declaration. Any reading of a variable without an in-scope declaration would have to be assumed to be global.
Geoff
- References:
- One more item to the collection of Lua hate-speech, Alexander Gladysh
- Re: One more item to the collection of Lua hate-speech, Luiz Henrique de Figueiredo
- Re: One more item to the collection of Lua hate-speech, Petite Abeille
- Re: One more item to the collection of Lua hate-speech, Wim Couwenberg
- Re: One more item to the collection of Lua hate-speech, Mark Hamburg
- Re: One more item to the collection of Lua hate-speech, Mark Hamburg
- Re: One more item to the collection of Lua hate-speech, Roberto Ierusalimschy
- Re: One more item to the collection of Lua hate-speech, Geoff Leyland
- Re: One more item to the collection of Lua hate-speech, Roberto Ierusalimschy
- Re: One more item to the collection of Lua hate-speech, RJ Russell
- Re: One more item to the collection of Lua hate-speech, Vaughan McAlley