lua-users home
lua-l archive

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

On Tue, Jan 12, 2010 at 5:25 PM, Roberto Ierusalimschy
<> wrote:
> change the environment of B. If function A calls B, B can change the
> environment of A. In other words, almost anything can change the
> environment of anything.

There's an Internet joke about programming languages which starts 'In
C, you shoot yourself in the foot' and goes on in hilarious details
about each language.  On a bad day, any dynamic language can be more
like "you stand on a landmine".

 Like C, Lua assumes that you are an adult once you are out of the
walled garden.  Often we set up environments with our godly powers,
and then create very restricted sandboxes for the masses. No
self-respecting god would let the masses near something like setfenv

It is good that constructing a function with an environment has become
this straightforward, because function environments were part of the
deeper Lua voodoo.  But the gods of sandboxes are assumed to know all
this and be sensible _also_.

steve d.