[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua 5.2 and in-do-end
- From: joao lobato <btnfdp.lobato@...>
- Date: Sat, 23 Jan 2010 21:57:53 +0000
Hello list
The in-do-end construct in Lua 5.2 compelled me to subscribe to the
list (rather than simply
browsing through the recent archives). Maybe this post should have
gone to a pre-existing
thread, in that case, please apologize the noise.
When I first read about "in <table> do <statement>+ end" my mental
picture of it was "any
variable reference in a function call inside <statement>+ that cannot
be resolved locally will
be looked up on <table>". A simple test and subsequent reading proved me wrong.
(1) As thay stand, what are the advantages of lexically environments
over closures or
__call'able tables?
(2) Wouldn't my interpretation up there cover both the sandboxing and
dynamic variable use
cases of [gs]etfenv more elegantly than a pair "loadin"/"callin" (or
"envcall" as that hypothetical
second function was called before on this list)?