[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: 5.2 Compatibility with Function 'Environments (Was: Moonscript as a useful notation...)
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 15 Aug 2013 12:58:18 +0200
On Thu, Aug 15, 2013 at 11:42 AM, Enrico Colombini <erix@erix.it> wrote:
> Found. Here it is: (Luiz)
>> You could write your function to be run in different environments:
>>
>> function f(_ENV,...)
>> ... -- code that never even mentions _ENV!
>> end
Yep, that's the trick! And the _cool_ thing is that writing functions
like this (or often compiling them as a wrapper for an expression)
does not in any way interfere with 5.1's setfenv. So you can have it
both ways with a if statement....
(This idiom will actually be faster than the 5.1 pattern)
(switching subject line to match the ... subject)