[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Explanation needed for setfenv replacement for Lua 5.2
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: Fri, 06 May 2011 04:40:25 +0200
On 04/05/2011 23.46, Roberto Ierusalimschy wrote:
Please, consider the following toy code:
This is the kind of use that deserves the use of the debug library,
because you explicitly want to break the usual visibility rules.
Clear separation of concerns. Lua is lexically scoped and _ENV & C. is
coherent with that. In this use getfenv/setfenv were a workaround to
emulate dynamic scoping, so I agree their use must be restrained and
marked as "beware - know what you are doing".