It could be done, but again: lexical scoping. Using "nonlocal" would make _ENV less elegant and it would make closures more verbose, for no practical benefit.
can you clarify with an example how _ENV becomes less elegant?
same for closures: why should they be more verbose?
(in the example in my previous email the keyword "nonlocal" appears once, while the keyword "local" appears three times)
Sure. Semantically they're isomorphic: you can always transform one into the other. But I think that "nonlocal" breaks one thing that I think most people assume by default: reading and writing should be symmetric, but "nonlocal" means that reading a value and writing a value have different semantics by default and you have to explicitly opt in to the symmetric behavior.
Thank you for confirming they're isomorphic. That was my thought (but I do not have the knowledge of the precise word to use).
I am not sure I fully understand what you mean by "symmetric" behavior.
writing: "x = 1" can be an assignment to local, upvalue, or global in both cases; it depends if/how x was declared before
reading: " ... = x" means referencing local, upvalue, or global in both cases; it depends if/how x was declared before
And yes, you're right: you can opt into a more aggressive error behavior with strict.lua.
Thank you very much for confirming!
Andrea