lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Duncan Cross wrote:
Yes, but while this is certainly true, for what real-world reason does
current code change the value of _G? The only one I'm aware of is to
set it to nil because you don't want people to have an easy reference
to that table for some reason - but if that's the case, they can just
use _ENV to refer to it anyway, so you would still need to change your

I'm all for maintaining back-compatibility whenever appropriate, but
it just seems like people are worried unnecessarily about technical
differences between _G and _ENV when the reality is that (a) they seem
to be there for much the same purpose and (b) pre-5.2 code will
largely need to be reviewed and re-thought-about anyway. Especially if
it uses getfenv/setfenv. [...]

Thats true... I also suspect that most people will just replace setfenv with debug.setfenv to save work, especially on old code.

Hmm... you may be right. I can see no clean (and backwards-clean) solution, but that's probably because I'm short sighted :-)