remove _ENV

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

remove _ENV

fschmidt
Administrator
I am thinking of removing _ENV, which means removing global variables.  All variables would be local and any undeclared variable would be a compile error.  This follows in the pattern of removing concepts from Lua.  And I just wasted 20 minutes tracking down an error caused by a wrong variable name, just as you did earlier today.  So what do you think?
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: remove _ENV

Hugo <Nabble>
I think this is okay. It is a big change, so maybe you should work on this only after the new Http code is stable. But you can decide this.
Reply | Threaded
Open this post in threaded view
|

Re: remove _ENV

fschmidt
Administrator
I think it is better to destabilize things once instead of twice, so I will make the change now and get it over with.
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: remove _ENV

fschmidt
Administrator
In reply to this post by fschmidt
I need to make _ENV optional.  I need _ENV for interactive environments like a shell.  This means that if _ENV is defined, it will be used.  So if you start a Luan file with
local _ENV = {}
then you can use undefined variable.  I also plan to add a "Lua" module that will provide Lua function names including _G.  To use it, do
local _ENV = require "luan:Lua"
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: remove _ENV

fschmidt
Administrator
done in rev 92c3d22745b8, closing
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture