[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Popularity contest
- From: liam mail <liam.list@...>
- Date: Mon, 26 Sep 2011 15:33:10 +0100
On 26 September 2011 11:31, steve donovan <firstname.lastname@example.org> wrote:
> On Mon, Sep 26, 2011 at 12:05 PM, steve donovan
> <email@example.com> wrote:
>> Assuming then that _ENV always exists as an upvalue, then _ENV.print
>> is an explicit way to access a 'global'.
> This is of course typical Monday morning nonsense; precisely because
> _ENV can be redefined. So _G is what I mean here.
> Except that in strict mode _G is an upvalue for any script, and any
> access to 'globals' has to go through it. So you have to say
> local print,io = _G.print, _G.io
> up front. (The import suggestion is merely sugar for this pattern)
> steve d.
_G is normally an alais for _ENV is 5.2 or an alais for the value set
unless I am misunderstanding something and there are no global lookups
so to speak anymore (ie GETGLOBAL vm instructions now use a new
instruction GET/SETTABUP), so I still do not understand why
_ENV/_G.print would be needed unless there is a print in local scope.
Sorry maybe the Monday afternoon nonsense is the time it effects me :p