[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: _ENV vs _G
- From: Tim Hill <drtimhill@...>
- Date: Wed, 13 Aug 2014 15:12:30 -0700
On Aug 13, 2014, at 3:00 PM, Coda Highland <chighland@gmail.com> wrote:
>>
>> Ah, interesting border-case. In fact, even if you DO specify an environment to loadfile() in this case it will be inaccessible to the function.
>>
>> I’ve not really given it much thought, but a function that declares _ENV as one of its arguments in fact has NO access to the global environment at all so far as I can see (except indirectly via upvalues or other arguments, both of which the caller can control). Is this, then, a Lua idiom for writing (partially) pure functions? With the obvious caveat that such a function is free to call impure functions.
>>
>> —Tim
>
> It feels to me more like a "with" block than any sort of functional idiom.
>
> /s/ Adam
>
Yes, possibly. In either case it’s just a minor observation.
—Tim
- References:
- _ENV vs _G, Mason Mackaman
- Re: _ENV vs _G, Steven Degutis
- Re: _ENV vs _G, Roberto Ierusalimschy
- Re: _ENV vs _G, Tim Hill
- Re: _ENV vs _G, Roberto Ierusalimschy
- Re: _ENV vs _G, Steven Degutis
- Re: _ENV vs _G, Dirk Laurie
- Re: _ENV vs _G, Tim Hill
- Re: _ENV vs _G, Dirk Laurie
- Re: _ENV vs _G, Tim Hill
- Re: _ENV vs _G, Dirk Laurie
- Re: _ENV vs _G, Tim Hill
- Re: _ENV vs _G, Dirk Laurie
- Re: _ENV vs _G, Tim Hill
- Re: _ENV vs _G, Dirk Laurie
- Re: _ENV vs _G, Tim Hill
- Re: _ENV vs _G, Coda Highland