[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: In praise of globals
- From: Thomas Jericke <tjericke@...>
- Date: Wed, 17 Apr 2013 16:10:39 +0200
That would defenitely be an improvement over the runtime attempt,
actually it would be very close to what I suggested. But
most scripts we have are actually loaded by calling lua_load(); in C not
from within Lua by "require".
So what you really need is not a change to the language, it's enhanced
"require", "load", "loadfile" and "dofile" functions with an optional argument
to make the load fail if the function ever generates a write to _ENV.
At most a backward-compatible change to the standard libraries.
I could support that.
"loadfile" does not work as there is no file system around ;-).
So then I would just write a C wrapper around lua_load(); that checks
what lua_load() produces. Of course it might be an option to check the
output of the parser. But what is the advantage compared to simply
change the parser at that particular place?
Even if I patched this in our variant I would have it as an option. I am
sure that I wont force everyone to change their scripts that uses our