lua-users home
lua-l archive

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


On Fri, 2019-07-12 at 00:15 +0300, Egor Skriptunoff wrote:
> This statement makes all names from the outer scope (with exception
> of white-listed names) invisible in the inner block.
> The statement works for all names independently of what a name is:
> local/upvalue/global.

To put it the other way: only specified free names are accessible.

Suggestion looks fairly good for me and I think shouldn't be too hard
to implement (no VM tweaks required as it's purely syntactic sugar).
One possible extension to it: add <const> (and probably <toclose> as
well?) specifier, so you can make sure that var isn't changed by
accident. Again, as we already have <const> locals, this probably
shouldn't be too hard to add into existing code.


-- 
v <v19930312@gmail.com>