[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: module() with _ENV
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 31 Mar 2010 16:07:17 -0300
> > BTW, note that setfenv/getfenv are not moving to the debug library, but
> > out of the language, as functions will not have environments anymore.
> * setfenv becomes 'set the upvalue named _ENV' (which is clearly
> a debug operation). If the function is the main function of a chunk,
> it must have only one upvalue, named _ENV.
> Doesn't that imply that there still will be a setfenv/getfenv which
> will work in term of that new _ENV thingy, no?
No. It implies that you will be able to do what setfenv/getfenv did
by using debug.setupvalue/debug.getupvalue. (There are some caveats
[see message from Mark Hamburg], but it is mostly doable.)